I already searched the forums but the only way i could find was with the use of start_dir but i want to save/load files into the same dir as the p3d so that the normal user can easily backup his saves
I would like to store some ini files there as well so that you can change game options as long as i haven’t implemented option dialogs.
Is this even possible or do i have to change to py2exe?
If you pass -c “keep_user_env=1” to packp3d, then the resulting p3d file will run in the current working directory, instead of in start_dir.
There is not, at the moment, an easy way to query where the p3d file was loaded from, though this has been requested.
I tryed it but it seems the cwd is the start_dir anyway.
The following code:
plini = Filename(os.path.join(os.getcwd(),'players.ini')).toOsSpecific()
will prompt this:
Hmm, it works for me. Can you use multify to examine the p3d_info.xml file within your p3d to ensure it contains keep_user_env?
How are you invoking the p3d file in this case?
<?xml version="1.0" encoding="utf-8" ?>
<package name="folks" platform="win32" version="0.0" main_module="main">
<config display_name="Folks PRE-Alpha" keep_user_env="1" />
<requires name="fmod" version="cmu_1.7" host="http://runtime.panda3d.org/" />
<requires name="audio" version="cmu_1.7" host="http://runtime.panda3d.org/" />
<requires name="panda3d" version="cmu_1.7" host="http://runtime.panda3d.org/" />
<host url="http://runtime.panda3d.org/" />
The .p3d file is started with the runtime (double-click from windows explorer)
If you double-click the p3d file from explorer, you don’t have a current working directory, so it has to use “start” anyway. You only have a current working directory if you launch the p3d file from the command line; and in that case, it preserves that working directory.
One option is to store the save and ini files in a standard directory, like “c:\mygame” or something along those lines.