Skip to content

Commit b4d260d

Browse files
committed
Add file paths example
1 parent d5e848d commit b4d260d

File tree

1 file changed

+8
-0
lines changed
  • articles/tutorials/building_2d_games/25_packaging_game

1 file changed

+8
-0
lines changed

articles/tutorials/building_2d_games/25_packaging_game/index.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,14 @@ When distributing your games across multiple platforms, be aware of these additi
376376
377377
Different operating systems use different path separators (Windows uses backslashes, macOS and Linux use forward slashes). Always use `Path.Combine` in your code rather than hardcoding path separators.
378378
379+
```cs
380+
// Incorrect approach - will fail on some platforms
381+
string path = "Content\\images\\atlas-definition.xml";
382+
383+
// Correct approach, works on all platforms
384+
string path = Path.Combine("Content", "images", "atlas-definition.xml");
385+
```
386+
379387
### Case Sensitivity
380388
381389
Windows is case-insensitive for filenames, but macOS and Linux are case-sensitive. Ensure your asset references use the exact case that matches your files for maximum compatibility.

0 commit comments

Comments
 (0)