I have a config file (ini) file I’d like to read in before my app starts. However I’m unsure how to deploy that via a web page? When I start the p3d it defaults to c:…\Local Settings\Application Data\Panda3D\start\filename.ini
And that’s on my xp windows machine, I’m sure other platforms are different.
Is there a prefered way to store game settings for a web plugin situation? It’s a rather large ini file with settings for images, reels (gambling app) etc…
The files are loaded starting from the ‘start’ folder, and on your machine that’s the one you wrote. Every user which installs the runtime has its own ‘start’ folder.
So, if you save the file in your code with something like:
open( 'filename.ini', 'w' )
This creates the file named ‘filename.ini’ in the ‘start’ folder.
If you open that file:
open( 'filename.ini' )
it’s loaded from that ‘start’ folder. As you see it’s a “relative” path process, so you don’t have to worry about absolute paths on every single machine.
Make one big string in a .py file, include it in main.py and write it out at runtime, then read in as an ini.
Do the same, but .py source as the string, read in, write it out and execute it
Diabolical eh? I love it.
put the ini in side your p3d, then use my code from here to work with it: [Working with files, inside p3d and not) (specifically, join the pathPrefix onto the beginning of your file path). Then it will be able to find tiles in your miltifile p3d.
If you need to modify the file, look at some place to see if it exists, if not, load from the p3d, and when saving, write to the place you check for it.