stb
13th September 2009 20:39 UTC
ChDir missing? (Working directory / CurDir)
Seems there is no built-in way of setting the current working directory (for installer process). Just copying a value to $OUTDIR does not work. I didn't try SetOutPath since this will create a directory (if missing) and maybe it just sets $OUTDIR, too.
I want to set the current working directory to something specific so I can use commands like FileOpen with relative paths. If the directory is missing the original working directory is a valid fallback.
Ideas?
jpderuiter
13th September 2009 21:19 UTC
To set the working directory you have to use SetOutPath indeed.
If you want to prevent the folder to be created, you have to check if the folder exists, and if not, SetOutPath to the original working directory.
stb
13th September 2009 21:44 UTC
Ok, seems that SetOutPath sets $OUTDIR, creates that directory if missing _and_ changes current working dir to that directory.
BTW: $OUTDIR is initially empty. Might need an API call to get the working directory at script start (GetCurrentDirectory).
jpderuiter
14th September 2009 00:09 UTC
Yes, you will need GetCurrentDirectory:
http://forums.winamp.com/showthread.php?postid=1973815
stb
14th September 2009 06:31 UTC
I just found some note in documentation of "Rename":
"If no absolute path is specified the current folder will be used. The current folder is the folder set using the last SetOutPath instruction. If you have not used SetOutPath the current folder is $EXEDIR."
I think something like this would be useful at documentation for $OUTDIR and especially SetOutPath. And it might be wrong since the working directory and $EXEDIR are generally NOT the same before using SetOutPath. So if "current folder" means the working directory the documentation is wrong.
stb
14th September 2009 06:38 UTC
Documentation for "FileOpen" has same comment, "RegDll" similar. Docs for "Exec", "ExecShell" and "CreateShortCut" should say what the working directory is if $OUTDIR is still empty.
The notion "current directory" is used for "File", too. But I guess this means the current working directory of makensis/makensisw process. This is not the working directory when starting makensis/makensisw but is the directory of the nsi file getting compiled.
pengyou
14th September 2009 13:54 UTC
To get the current working directory I use
GetFullPathName $WORKING_DIR ".\"