Old 29th March 2004, 22:44   #1
YooperNC
Junior Member
 
Join Date: Nov 2003
Location: Raleigh, NC
Posts: 17
Send a message via AIM to YooperNC
Delete and/or RMDir

I'm using the latest full release of NSIS, 2.0. My installer creates a directory that isn't in or near the $INSTDIR. When I go to Delete files from that directory or when I try to RMDir that directory, nothing happens. No ErrorFlags are set. I have tried just about everything. I even went so far as to store the created directory in the registry and read it back out during Uninstall. I posted a MessageBox to myself, verifying that the string is correct.

Has anyone else seen this? Is it a known problem? Or is it "Operator Error". There's not much to see in my script, but if you want some pieces cut out of my installer, let me know, and I'll be happy to post them here.

Any and all help would be greatly appreciated. Thanks!

Dave
YooperNC is offline   Reply With Quote
Old 30th March 2004, 03:19   #2
deguix
Major Dude
 
deguix's Avatar
 
Join Date: Dec 2002
Location: Everett - MA, USA
Posts: 1,354
Send a message via ICQ to deguix
RMDir - 2 possibilities:
Quote:
Without /r [as a parameter], the directory will only be removed if it is completely empty.
Quote:
If /REBOOTOK is specified [as a paramenter], and the directory cannot be overwritten, then the directory will be deleted when the system reboots... [so] the reboot flag will be set [but not the error flag].
Delete - 2 possibilities:
Quote:
The error flag is not set from trying to delete a file that does not exist.
Quote:
If /REBOOTOK is specified and the file cannot be deleted then the file is deleted when the system reboots... [so] the reboot flag will be set.

My Wiki Pages

Working now on:
New projects. (language: any)
deguix is offline   Reply With Quote
Old 30th March 2004, 10:37   #3
pol
Junior Member
 
Join Date: Jun 2003
Posts: 18
Post Perl script to list all files

Hello,

I have made a simple perl sript to list all files of your project with RMDir and Delete instructions.

This is very usefull if your project have a lot of files (more than 2000 in my case) and if you want to make a clean and complete uninstall.

The result is saved in a separate file. You will need to add
!include "uninstall.nsh"
in your uninstall secion

The uninstall.nsh will look like this:

Delete "$INSTDIR\webdav\tomcat.gif"
Delete "$INSTDIR\webdav\tomcat-power.gif"
Delete "$INSTDIR\webdav\index.html"
Delete "$INSTDIR\webdav\WEB-INF\web.xml"
RMDir "$INSTDIR\webdav\WEB-INF"
RMDir "$INSTDIR\webdav"
Delete "$INSTDIR\tomcat-docs\index.html"
RMDir "$INSTDIR\tomcat-docs"
...

Philippe
Attached Files
File Type: zip list_files.zip (768 Bytes, 194 views)
pol is offline   Reply With Quote
Old 30th March 2004, 14:04   #4
YooperNC
Junior Member
 
Join Date: Nov 2003
Location: Raleigh, NC
Posts: 17
Send a message via AIM to YooperNC
Nowhere in the documentation do I see a "/REBOOTOK" for RMDir. Also, I have tried all combinations of "RMDir /r ...", "Delete /REBOOTOK ...", etc., and nothing has worked. Even after rebooting the OS, the files are still there. I get the subdirectory from the registry just fine with:

ReadRegStr $R6 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${MUI_PRODUCT_NAME}" \
"UninstallVideoLoc"

I've tried:

Delete "$R6\*.*"
Delete /REBOOTOK "$R6\*.mpg" ; still there after reboot
RMDir /r "$R6"
RMDir /r $R6 ; thinking the quotes were causing a problem

I am able to remove other directories, namely $INSTDIR, but this one is being stubborn. My collegues and I are stumped. Has anyone else had luck removing files that are not in the $INSTDIR (for example)? If so, can you share some insight? Thanks!

Dave
YooperNC is offline   Reply With Quote
Old 30th March 2004, 14:28   #5
deguix
Major Dude
 
deguix's Avatar
 
Join Date: Dec 2002
Location: Everett - MA, USA
Posts: 1,354
Send a message via ICQ to deguix
Hmmm... nowhere... What NSIS version are you using?

My Wiki Pages

Working now on:
New projects. (language: any)
deguix is offline   Reply With Quote
Old 30th March 2004, 15:54   #6
pengyou
Major Dude
 
Join Date: Mar 2003
Posts: 571
YooperNC wrote:

>>I'm using the latest full release of NSIS, 2.0.<<
>>Nowhere in the documentation do I see a "/REBOOTOK" for RMDir.<<

From the NSIS 2.0 manual:

4.9.1.8 RMDir
[/r|/REBOOTOK] directory_name
Remove the specified directory (which should be a full path). Without /r, the directory will only be removed if it is completely empty. If /r is specified, the directory will be removed recursively, so all directories and files in the specified directory will be removed. If /REBOOTOK is specified, and the directory cannot be overwritten, then the directory will be deleted when the system reboots -- if the directory will be removed on a reboot, the reboot flag will be set. The error flag is set if the directory cannot be removed.
pengyou is offline   Reply With Quote
Old 30th March 2004, 20:27   #7
YooperNC
Junior Member
 
Join Date: Nov 2003
Location: Raleigh, NC
Posts: 17
Send a message via AIM to YooperNC
Ok. Now I see that /REBOOKOK was added to RMDir. Thanks for the clarification.

But that still doesn't help me out. Like I said, I've tried all manner of combinations and permutations of the parameters, and nothing gets rid of these files. At one point, I noticed that the files contained within this directory were "Read-Only". However, removing this attribute made no difference.

Could it be a problem that I'm running on Windows XP? (I could blame Bill Gates, then)

I could always just tell the user to delete the files after Uninstallation is complete, but I'd rather not.

Thanks to all for your time.
YooperNC is offline   Reply With Quote
Old 30th March 2004, 20:34   #8
Joost Verburg
NSIS MUI Dev
 
Join Date: Nov 2001
Posts: 3,717
It should work fine. Please post relevant script code and details.
Joost Verburg is offline   Reply With Quote
Old 31st March 2004, 21:34   #9
YooperNC
Junior Member
 
Join Date: Nov 2003
Location: Raleigh, NC
Posts: 17
Send a message via AIM to YooperNC
Here's the script that I'm executing:

ReadRegStr $R6 HKLM \
"Software\Microsoft\Windows\CurrentVersion\Uninstall\${MUI_PRODUCT_NAME}" \
"UninstallVideoLoc"
RMDir /r $R6
Sleep "200"

I've placed a MessageBox between the ReadRegStr and the RMDir, so I know that $R6 has exactly what I expect in it. I have also tried this:

ReadRegStr $R6 HKLM \
"Software\Microsoft\Windows\CurrentVersion\Uninstall\${MUI_PRODUCT_NAME}" \
"UninstallVideoLoc"
Delete /REBOOTOK "$R6\*.*"
Sleep "200"

Each time, the files are still there. $R6 is:

C:\Video Files\test

This subdirectory contains the following files:

b281_20021230_162454.mpg
b281_20030103_124700.mpg
b281_20030109_142723.mpg
b281_20030225_095223.mpg
b281_20030226_102234.mpg
c122_20021222_090342.mpg
c353_20030305_161208.mpg
c353_20030309_000920.mpg
c353_20030309_004436.mpg

There's nothing wrong with this directory string that I can tell. And the files are nothing more than random video files varying in size from 19KB to 102KB. They are not read-only, so no use asking that question.

I've also placed "ClearErrors" and "IfErrors" around the RMDir and Delete commands, but no errors are set. It just goes along thinking that it did its job.

We're all stumped here. This problem defies logic and reason. If you have some time and like solving tough problems, feel free to create a subdirectory like the one above, fill it with some files, and put those script lines in your Uninstall section. I'd be very interested to hear your results. Thanks!

Dave
YooperNC is offline   Reply With Quote
Old 31st March 2004, 21:58   #10
Joost Verburg
NSIS MUI Dev
 
Join Date: Nov 2001
Posts: 3,717
The files are either in use or you have a wrong directory name.

Try to add it manually (without the registry key) and make sure the directory is valid.
Joost Verburg is offline   Reply With Quote
Old 2nd April 2004, 05:17   #11
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
That registry key probably contains a line break, quotes or a space. Use
code:
MessageBox MB_OK *$R6*
and make sure nothing is between the unquoted path and the asterisks.

A similar case is presend in the FAQ:
http://nsis.sourceforge.net/support/...&tx_faq_faq=20

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik 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