Skip to content
⌘ NSIS Forum Archive

multiple path manipulation

13 posts

mancini#

multiple path manipulation

hey guys anyone knows or can telll from the code of
http://nsis.sourceforge.net/archive/...ances=0,11,211 or http://nsis.sourceforge.net/archive/...ances=0,11,211

what would be the corect delimiter between strings values for $PATHS (when using $PATHS intead of $INSTDIR in order to register multiple paths)

i tried
!define PATHS "C:\folder\bin,C:\folder\lib"
!define PATHS "C:\folder\bin;C:\folder\lib"
!define PATHS "C:\folder\bin|C:\folder\lib"
!define PATHS "C:\folder\bin C:\folder\lib"
!define PATHS "'C:\folder\bin','C:\folder\lib'"
and none worked
pengyou#
Here is a snippet from the first link you mentioned:
FileOpen $1 "$1\autoexec.bat" a
FileSeek $1 0 END
GetFullPathName /SHORT $0 $0
FileWrite $1 "$\r$\nSET PATH=%PATH%;$0$\r$\n"
FileClose $1
A semicolon is used as the separator in the PATH (see the FileWrite line in the snippet)

The PATH in the snippet is an environment variable (the snippet is adding a line to the end of AUTOEXEC.BAT).

I am not sure what you meant when you used "!define PATHS whatever" in your message. Are you trying to provide a selection of possible installation folders?
mancini#
no man
i am just trying to add paths
the original scripts use $INSTDIR to add only a path ( the instalation path )
i replaced that with ${PATHS} as i need to add multiple paths that are not related to the $INSTDIR

the format that interests me is of the data in ${PATHS} not in autoexec.bat
pengyou#
The first Archive link gives this example which adds $INSTDIR to the path:
Push $INSTDIR
Call AddToPath
If you want to add "C:\ABC" and "D:\XYZ\123" to the path, call AddToPath twice:
Push "C:\ABC"
Call AddToPath

Push "D:\XYZ\123"
Call AddToPath
The AddToPath function uses GetFullPathName which is why the function only works with one path at a time.

Remember that on Win9X systems there is a limit to the length of the PATH (not sure what it is).
mancini#
thanks man
as for the win98 limitation it can be fixed with this line
SHELL=command.com /e:956 /p
in config.sys
mancini#
well

Push "C:\ABC"
Call AddToPath

Push "D:\XYZ\123"
Call AddToPath
should work but unfortnately it does not

KiCHiK http://nsis.sourceforge.net/archive/...ances=0,11,211 is your code .. can you help me with this ?
mancini#
well i think it works fine on winNT but on 9X:
quote from autoexec.bat
SET PATH=%PATH%;C:\APACHE2\BIN







SET PATH=%PATH%;C:\APACHE2\BIN

SET PATH=%PATH%;

SET PATH=%PATH%;

SET PATH=%PATH%;

SET PATH=%PATH%;

SET PATH=%PATH%;

SET PATH=%PATH%;
also if possible could you save me the hassle and make a version of that script for nt only ... i will add the paths to autoexec.bat another way ....
kichik#
Are you sure those are not left overs from previous failed attempts?

To make it NT only just remove the part that writes to the autoexec.bat file.
mancini#
100 percent sure
i even deleted autoexec and run the installer 3 times
here is the new autoexec contents
SET PATH=%PATH%;C:\APACHE2\BIN

SET PATH=%PATH%;

SET PATH=%PATH%;

SET PATH=%PATH%;

SET PATH=%PATH%;

SET PATH=%PATH%;

SET PATH=%PATH%;

SET PATH=%PATH%;C:\APACHE2\BIN

SET PATH=%PATH%;

SET PATH=%PATH%;

SET PATH=%PATH%;

SET PATH=%PATH%;

SET PATH=%PATH%;

SET PATH=%PATH%;

SET PATH=%PATH%;C:\APACHE2\BIN

SET PATH=%PATH%;

SET PATH=%PATH%;

SET PATH=%PATH%;

SET PATH=%PATH%;

SET PATH=%PATH%;

SET PATH=%PATH%;
this is the code i use

Push "C:\apache2\bin"
Call AddToPath
Push "C:\apache2\perl\bin"
Call AddToPath
Push "C:\apache2\php\bin"
Call AddToPath
Push "C:\apache2\mysql\bin"
Call AddToPath
Push "C:\apache2\opssl\bin"
Call AddToPath
Push "C:\apache2\python\bin"
Call AddToPath
Push "C:\apache2\tcl\bin"
Call AddToPath

and if i just delete the line wich writes to aeutoexec.bat im still left with a lot of grabage .. checking for os .. etc
kichik#
As you can see, there are 7 lines a block there, and there are 3 blocks for 3 times you've ran the installer. This means the function is doing its job, writing a line for each call and doesn't fill it with garbage.

Because autoexec.bat requires a short path name, AddToPath calls GetFullPathName /SHORT to get the short path name. This doesn't work when the path doesn't exist. Are you sure all of those paths exist? Since there isn't really much code there and the first call does work, this is the only explination I can think of.
mancini#edited
yes silly me
i was testing without full directory structure
the apache\bin entry was created because that was the only dir existant

however there is still a problem with removing
i use

Push "C:\apache2\bin"
Call un.RemoveFromPath
Push "C:\apache2\perl\bin"
Call un.RemoveFromPath
Push "C:\apache2\php\bin"
Call un.RemoveFromPath
Push "C:\apache2\mysql\bin"
Call un.RemoveFromPath
Push "C:\apache2\opssl\bin"
Call un.RemoveFromPath
Push "C:\apache2\python\bin"
Call un.RemoveFromPath
Push "C:\apache2\tcl\bin"
Call un.RemoveFromPath
and it just leaves autoexec.bat as it was

btw by garbage i meant things like the un.IsNT function and the calls to it wich would not be needed it i would made the script nt only

bbtw : why is tah function defined twice ?
kichik#
Works fine for me, existing paths or not. Does the install log show anything?

I wouldn't remove IsNT if I were you... Why write to the registry on Windows 98 too?

There are two versions of IsNT because you can't use installer functions in the uninstaller and vice versa.