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:
"Data" is a folder off the installation root (ie: c:\Program Files\My Game\).
"joystickMapping" is just a struct defined elsewhere.
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,
Rich
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.
Sounds like you should be saving to the ALLEGRO_USER_SETTINGS_PATH location.
al_get_standard_path(ALLEGRO_USER_SETTINGS_PATH)
al_make_directory() if does not exist (no guarantee that it does)
Create a path based off of that directory + db_joystickconfig.dat via al_set_path_filename()
And if you want to write actual data (and not config), you use ALLEGRO_USER_DATA_PATH.
Awesome, thanks guys. My first Windows game, not used to all this security stuff. I appreciate your help.
Rich
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.
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?
You don't want to. The user will get a big scary UAC popup.