Local Directories
To get to specific local directories on the system where a game is running
Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
This works on multiple platforms, including windows, linux, mac, and android.
For example, if you wanted to create a folder under ‘My Games’ for a single game's save data, consider the following code:
string gameName = "Tetris"; string userDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "My Games", gameName); if (!Directory.Exists(userDirectory)) { Directory.CreateDirectory(userDirectory); }
More information can be found at: