Old 1st May 2011, 20:31   #1
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Quote:
-but RMDir /r "$INSTDIR" have also quotes and it works,... the $0 includes the "" so i removed them in the script -> RMDir /r $0
That is the same as doing RMDir /r '"some_path"'. RMDir does not accept quotes around its path.
Quote:
RMDir /r "" -> doesn NOT delete ROOT or anything else. I tested it right now on the VM. =)
Looks like code was added quite a while ago to prevent this. My bad.
Quote:
I think, the best way will be to check that the last dir is ..."/MyProgram" to make sure the User didnt use "C:\" or "C:\Program Files" as installation directory!? but how to do it?
Use StrCpy $0 $path "" -X to get the last X characters of the path.
Quote:
when i try to use your script, the compiller breaks with:

I implement it exactly as you described.
The line of error:
${File} /r "${BIN}\*"
You cannot use the recursive switch as the macro requires you to explicitly tell it each file name/path. If you need to use these macros but with recursion then you need to write a program that generates the NSIS script (i.e. the individual ${File} instructions for each file).

Stu
Afrow UK is offline   Reply With Quote
Old 1st May 2011, 20:47   #2
Smurge
Junior Member
 
Join Date: Apr 2008
Posts: 21
Quote:
That is the same as doing RMDir /r '"some_path"'. RMDir does not accept quotes around its path.
I just assumed that the Path have to be in "". I dint know that it needed ' to function properly. All examples i read, had "" with RMDir! so what is the problem with it?

The manual don't show any necessary format:
http://nsis.sourceforge.net/Docs/Chapter4.html#4.9.1.8

--------
Quote:
Originally Posted by Afrow UK View Post
If you need to use these macros but with recursion then you need to write a program that generates the NSIS script (i.e. the individual ${File} instructions for each file).
This is too complex for me. I don't have any professional programming skills.

Cant i just use the ${File} ..\* for the app and any sub directory? will this delete/uninstall those sub dirs as well?

------

by ignore you mean to skip the IF? like this:

PHP Code:
    ReadRegStr $2 HKLM "Software\${REGKEY_GROUP}\${REGKEY_NAME}" "InstallDir"
   
${If} $!= $INSTDIR
    
;Something is wrongFall back to checking for filenames.
    ${
IfNot} ${FileExists"$INSTDIR\MyApp.exe"
    
${OrIfNot} ${FileExists"$INSTDIR\MyOtherFile.dat"
    
${OrIfNot} ${FileExists"$INSTDIR\Etcetera.etc"
      
MessageBox MB_YESNO|MB_ICONEXCLAMATION "WARNING: Setup could not verify that this uninstaller is being run from its proper \
                 directory. If you have moved Uninstall.exe to a directory other than the actual installation folder, it is \
                 impossible to guarantee that the uninstallation will be executed properly. If you proceed, it is theoretically \
                 possible that setup will delete files that should not be deleted. Are you sure you wish to continue with \
                 the uninstallation?" 
IDYES +2
      quit 
;quit installer.
    ${EndIf}
  ${EndIf} 
Smurge is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump