hi, i was making a portable app and i decided to first change the source code to make it portable instead of copying files all over the place. I changed a py file to set the path of the ini file to the current folder instead of Application Data. It stored the ini in the current folder fine but when i made the portableapps nsis launcher and launched it from that, then the ini file started showing up in the same folder as the nsis launcher instead of where it should be. I made a workaround for it but i'm a perfectionist and want to fix the problem. Why is it doing that, any ideas? (btw i'm kinda a noob to programming)
Thanks for any help
It does exactly what you asked it to
The working directory is usually the directory you started it from. Example: Your program is in "c:\PA\prog.exe". Your launcher - "c:\l.exe". You enter "c:\" and double click "l.exe" - your working dir is "c:\". Then the launcher calls ".\PA\prog.exe". It would work the same way if you run ".\PA\prog.exe" from command prompt from c:\. Generally, working directory is variable and in no way depends on your exe location. You should find your exe (programmatically) and use it's path instead of working dir.
"Those people who think they know everything are a great annoyance to those of us who do." Asimov
If $PROGRAMDIRECTORY is where the "real" exe is stored, then the instruction
will make it the working directory.
Any reason not to make .\Data the working directory, though? Then the configuration files will get stored in the Data directory directly, and you won't have to make the launcher move them around.
MC
well I did change it to using the Data directory now, but i had to do a dynamic link from the nsis exe instead of the original which i guess is fine unless someone tries to launch the real exe directly, but ok, i'll try to implement that SetOutPath and see what happens
Thanks