p3d writefile [SOLVED]

Hello,

my purpose is to create a multiplayer game, with a central server.
The client will communicate with the server, and maybe the client will manage local files on its own side.

I have generated a p3d file, and I have tested to create new file with datas, close the file, reopen the file in read mode, and print the content of the file.
All is ok…

But…

where is stored the file. I have specify as path ./datas/config.xml. But I don’t see it from where the exe is launched.

Where are stored file created from p3D?

They are loaded from the virtual file system; the files don’t physically exist as files on the disk, but Panda pretends they do. I believe the p3d file is mounted to ~/.panda3d/start, but I’m not 100% sure. In any way, I think you can rely on the current working directory being the directory in the root of your .p3d file- as in, you can load your files relative to that root.

For now, If I want to create persistent files (as for user preferences) on the disk, how can I proceed?

Hmm, good question; I don’t think we provide a method for persistent storage, you’ll probably have to come up with your own system to do this.

Also see:
[p3d and external files?)

In fact, I successfully create a directory, and a xml file.

my test.exe (created by pdeploy) create the directory and the file into :

C:\Documents and Settings\shimrod\Local Settings\Application Data\Panda3D\start

it is fine for me.
I create the file in a first launch of the game, and when I stop the game, and relaunch it, it is able to read the file created previously.

I’m just not sure if that directory is preserved when you run a different .p3d file. But if it works, then hey, go for it.