Archive: Another uninstall question


Another uninstall question
I am trying to uninstall a directory that I created with the CreateDirectory command during the install process. I am using:

rmdir /r "$INSTDIR\dir"

($INSTDIR=C:\") but, the directory never gets removed. I changed the $INSTDIR variable to the actual drive letter, rmdir /r "C:\dir" and it works just fine. Is this an issue with a root installations or am I doing something wrong? Any ideas would be appreciated.

Thanks in advance,

J.


Why not:


RMDir /r "$INSTDIR" ;this will delete all files and folders on it.

I can't use, RMDir /r "$INSTDIR" , because $INSTDIR is the root of C:\. I am just trying remove the specific folders that I create in $INSTDIR.

J.


Then...


RMDir /r "$INSTDIR\dir1"
RMDir /r "$INSTDIR\dir2"
...

Add

MessageBox MB_OK $INSTDIR

and check the result.

Maybe there is a \ at the end, so you get C:\\, but I think NSIS automatically removes it.


I inserted the MessageBox MB_OK $INSTDIR and the results were fine,
C: .

So i guess what this means is the the rmdir /r "$INSTDIR\dir" command does not work on a folder if $INSTDIR is the root of the drive.

Hmmm.


J.


RMDir should only not delete if you are trying to delete the drive itself if you have used AllowRootDirInstall true (C: for example won't work, C:\ would work). I will check it out.

BTW, How did you get the uninstall to accept C: as your $INSTDIR?


Here is how I set C: for $INSTDIR

!define SYSDRIVE "C:\\"
AllowRootDirInstall true
InstallDir ${SYSDRIVE}

It seems to work for the install. Directories get created fine, files get put where the need to be, it's just during the uninstall where it has problems. When the uninstaller runs it doesn't give any errors it just won't remove the directory.

I made another base script as a test and found that the a MessageBox command in the install section that checks the variable $INSTDIR was correct but when I had another MessaageBox in the uninstall section, it was wrong. I am not sure what the deal is but I attached the test script that I used. Maybe someone can figure this out. It has me confused.

Thanks in advance,

J.


dumpstate
Not sure if this helps any but I ran a dumpstate call in the install section and in the un-install section. Below are the results...

Install Section Dumpstate:

$0:
$1:
$2:
$3:
$4:
$5:
$6:
$7:
$8:
$9:
$R0:
$R1:
$R2:
$R3:
$R4:
$R5:
$R6:
$R7:
$R8:
$R9:
$CMDLINE: "E:\Projects\Install\testApp.exe"
$INSTDIR: C:
$OUTDIR:
$EXEDIR: E:\Projects\Install
$LANGUAGE: 1033


Un-Install Section Dumpstate:

$0:
$1:
$2:
$3:
$4:
$5:
$6:
$7:
$8:
$9:
$R0:
$R1:
$R2:
$R3:
$R4:
$R5:
$R6:
$R7:
$R8:
$R9:
$CMDLINE: "C:\Temp\A~NSISu_.exe"
$INSTDIR: C:\Testdir
$OUTDIR: C:\Testdir
$EXEDIR: C:\Temp
$LANGUAGE: 1033

?


Latest CVS version allows you to put the uninstaller on the root directory (assuming you use AllowRootDirInstall true). I'm sorry for the long delay.


Part of the problem could be that "OUTDIR" is set to the directory that you want to remove. I have found this to be a problem. It could be that when OUTDIR is set to a directory, that directory is "in use" as far as NSIS is concerned. In any event, try issuing

SetOutPath ""

before the 'RMDir', and see if this helps.

I am experiencing a similar problem. One pesky directory is not being removed, so $INSTDIR is also not being removed. The subdirectory is completely empty. It has no hidden files (I know because I have the option to show hidden files set in my Windows Explorer). Yet 'RMDir /REBOOTOK "$INSTDIR\DSFilters"' does not remove the directory. I can manually delete both it and $INSTDIR after the fact. All other 'RMDir /REBOOTOK ...' commands work just fine (except of course 'RMDir /REBOOKOK "$INSTDIR"').

I see nothing different in the failing subdirectory as compared to the subdirectories which are successfully removed. I do, however, see a lot of posts on this forum asking for help with this issue.

I wonder if there is an inherent bug in NSIS that is eluding our efforts. Unfortunately, I don't know how else to describe this problem.


If you have problems removing folders from your installer, make sure your uninstaller itself is not in use.

If you execute your uninstaller in a normal way NSIS will automatically create a temporary copy of your uninstaller.