Skip to content
⌘ NSIS Forum Archive

CheckForSpaces from the Archive ?

11 posts

0kermit0#

CheckForSpaces from the Archive ?

Hello,

the CheckForSpaces from the Archive (http://nsis.sourceforge.net/archive/...php?pageid=179) doesnt work in the cvs-version.

what should i do to get it to work ?

with 2.0b3 it worked.
Afrow UK#
I'm not running latest CVS version, and it works fine (on both paths with and without spaces).
It must be the latest CVS version causing a problem...

[edit]What happens?[/edit]

-Stu
0kermit0#
i get the "spaces-error" 5 times if i want to change the install-dir (but there are no spaces in there).

Here is the code:

Function .onVerifyInstDir

Call CheckForSpaces
Pop $R0

IfFileExists $INSTDIR\execute\payslip.exe PathGood

Abort ;
PathGood:

FunctionEnd
Afrow UK#
You have to

Push $INSTDIR
Call CheckForSpaces
Pop $INSTDIR

If $INSTDIR has spaces in it (Push), then it will report an error, then $INSTDIR will have all spaces removed (from Pop).

-Stu
Afrow UK#edited
I've just updated the script page, so now it goes back to the directory page if the user has entered a path containing spaces.

Just call the function like so:
Page Directory "" "" "CheckForSpaces"

Or MUI:
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE "CheckForSpaces"
!insertmacro MUI_PAGE_DIRECTORY

-Stu
0kermit0#
i cant get it to work. i get the errors described above.

but i will try it with a new clean install-script.
0kermit0#
hi again,

there is a problem with the "IfFileExist" and the "Checkforspaces-Function".

i comented the checkforspaces-function-call out and it works.

Function .onVerifyInstDir

;Push $INSTDIR
;Call CheckForSpaces
;Pop $INSTDIR

;StrCpy $INSTDIR $R0

IfFileExists $INSTDIR\execute\test.exe PathGood

Abort ;
PathGood:


FunctionEnd



But i want to call the checkforspaces function before the "IfFileExist". With 2.0b3 it works.
Afrow UK#
Well thats quite obvious; you are setting $INSTDIR to whatever $R0 is, so if $R0 = "" then IfFileExists will fail. Remove the StrCpy $INSTDIR $R0 completely.

And you should also check back at the archive page for this function (http://nsis.sourceforge.net/archive/...php?pageid=179)
I've added some important stuff to it, and it is called differently too.

-Stu