You are here

Python or NSIS help

4 posts / 0 new
Last post
Travis Carrico
Offline
Last seen: 15 years 12 months ago
Developer
Joined: 2006-10-22 00:30
Python or NSIS help

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

m2
Offline
Last seen: 13 years 9 months ago
Joined: 2006-12-12 12:00
It does exactly what you

It does exactly what you asked it to Wink
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

rab040ma
Offline
Last seen: 5 months 3 days ago
Joined: 2007-08-27 13:35
SetOutPath $PROGRAMDIRECTORY

If $PROGRAMDIRECTORY is where the "real" exe is stored, then the instruction

SetOutPath $PROGRAMDIRECTORY

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

Travis Carrico
Offline
Last seen: 15 years 12 months ago
Developer
Joined: 2006-10-22 00:30
well I did change it to

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

Log in or register to post comments