• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

My documents path (in every language) ?

DaveInDev

Member
Hi there,

I want the user to load/save user files, choosing their names, so I will use the get_*_filename_ext functions for that, out of the sandbox.
But by default, they open a browser in the program's directory (c:\program\my_game), which is not convenient because it's not a writable directory.

I would better call these get_*_filename_ext functions pointing to the "documents" folder of the user.
I just wonder how I can get this...
I know that with environment_get_variable("userprofile"), I can retrieve the user's global folder (like c:\users\name),
but how can I retrieve the documents folder (the name of this folder depends on the language, for example "my documents" in english,
but "mes documents" in french)...
And I also know that a user can totally change its documents path to something like "d:\docs"...
 
Last edited:

TsukaYuriko

☄️
Forum Staff
Moderator
These folders have the same name regardless of the system language. The localized variants are merely shortcuts (symlinks) that lead you to the system folder with the English name.

The naming and path of this folder is not consistent across different versions of Windows. You therefore can't make this work with 100% accuracy. There's no environment variable for it, but you may be able to get the path via an extension (there are various methods). I'm not sure if that's worth the effort, though.
 

DaveInDev

Member
These folders have the same name regardless of the system language. The localized variants are merely shortcuts (symlinks) that lead you to the system folder with the English name.

The naming and path of this folder is not consistent across different versions of Windows. You therefore can't make this work with 100% accuracy. There's no environment variable for it, but you may be able to get the path via an extension (there are various methods). I'm not sure if that's worth the effort, though.
Great ! I did not know this symlink stuff, and infact I verified that in french, the %userprofile%\documents leads to the correct localized directory, so I will use this, and test if it exists. If not, I will let the user choose any other directory. I just wanted to propose this default directory that will exist in most cases.
 
Last edited:
Top