hello_d1
4th November 2009 14:22 UTC
need help please
Hi, everyone
I have a problem and need help.
The app that is getting installed must not have a space (' ') in its directory path.
which means:
C:\Program Files\App is an invalid path for the app.
C:\App is a valid path.
How can I check, if there are spaces in $instdir or not?
Any help will be appreciated.
CG!
4th November 2009 15:22 UTC
First thing that comes in my mind is to remove all possible spaces from the installpath variable, put the result into another variable and then compare both.
Something like this:
${StrReplace} '$R0' ' ' '' '$INSTDIR'
${if} $R0 != $INSTDIR
MessageBox MB_OK "The selected Path contains spaces !!!"
${else}
;Path is OK
${endif}
i used something similiar to remove the dots from a versionnumer to compare them.
The rest of the StringReplace function is mentioned here: NSiS:StrRep (
http://nsis.sourceforge.net/StrRep).
You need the whole function code, mentioned there, to make this work.
Zinthose
4th November 2009 16:22 UTC
You want to use "GetFullPathName"
Pulled directly from the help file...
StrCpy $INSTDIR $PROGRAMFILES\NSIS
SetOutPath $INSTDIR
GetFullPathName $0 ..
DetailPrint $0 # will print C:\Program Files
GetFullPathName /SHORT $0 $INSTDIR
DetailPrint $0 # will print C:\Progra~1\NSIS