|
Game cannot write to its installation folder |
Werwolf696
Member #15,203
June 2013
|
Hello, I just recently finished up a game in A5, used the nullsoft installer to create a deployment package, went over to my wife's laptop (running Windows XP Professional), installed ok, ran ok up until the point it need to save data to a file (I'm using the Boost library for serialization): Code like this: 1std::ofstream output_file("Data/db_joystickconfig.dat", std::ios::binary);
2boost::archive::binary_oarchive oa(output_file);
3oa << joystickMapping;
4output_file.close();
"Data" is a folder off the installation root (ie: c:\Program Files\My Game\). Anyone have experience with this? It runs fine if I launch the shortcut as Administrator, so I know it's permission related, just not sure how to "force" it or give it permission to write. Thanks, |
Thomas Fjellstrom
Member #476
June 2000
|
That's modern OSs for you. you can't write to system directories. You need to use the user's or shared user's data directory. in A5, you can use the al_get_standard_path function for that. Otherwise you basically need operating specific apis to get that information. -- |
Matthew Leverton
Supreme Loser
January 1999
|
Sounds like you should be saving to the ALLEGRO_USER_SETTINGS_PATH location.
|
Thomas Fjellstrom
Member #476
June 2000
|
And if you want to write actual data (and not config), you use ALLEGRO_USER_DATA_PATH. -- |
Werwolf696
Member #15,203
June 2013
|
Awesome, thanks guys. My first Windows game, not used to all this security stuff. I appreciate your help. Rich |
l j
Member #10,584
January 2009
|
There's a special folder for saved games on windows vista and newer versions of windows, the allegro API doesn't support anything to find this folder though. Might be useful to have a function that returns a special path to the saved games folder if one is available. Anyway, some games do save to the program files folder directly. It can be done by requesting admin privileges.
|
Werwolf696
Member #15,203
June 2013
|
taron said: Anyway, some games do save to the program files folder directly. It can be done by requesting admin privileges. Taron, how does one request admin privileges within the game? |
Thomas Fjellstrom
Member #476
June 2000
|
You don't want to. The user will get a big scary UAC popup. -- |
|