我有一个带有RMDir /r
指令的NSIS脚本,它不会删除目标目录(它只是清空它)。
$ makensis -version
v16-Dec-2013.cvs
$ pwd
/Users/mgarciaisaia/.wine/drive_c
$ ls
Program Files users windows
$ wine ~/InstallerTest.exe
$ ls
InstallerTest Program Files users windows
$ find InstallerTest
InstallerTest
InstallerTest/SomeData
InstallerTest/SomeData/some-file.txt
InstallerTest/SomeData/Uninstall.exe
$ wine InstallerTest/SomeData/Uninstall.exe
$ ls
InstallerTest Program Files users windows
$ find InstallerTest
InstallerTest
关于在MacOSX中使用wine的问题不(在Windows上也是如此)。
我已将installer.nsi
修剪为此示例:
!addplugindir nsis
!define MUI_PRODUCT "InstallerTest"
CRCCheck On
!include "MUI2.nsh"
Name "${MUI_PRODUCT}"
BrandingText "${MUI_PRODUCT}"
OutFile "InstallerTest.exe"
ShowInstDetails "nevershow"
ShowUninstDetails "nevershow"
!define SOME_DATA "C:\InstallerTest\SomeData"
!define MUI_ABORTWARNING
Caption "${MUI_PRODUCT} Installer"
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"
Section "Install" Install
DetailPrint "Installing..."
SetOutPath "${SOME_DATA}"
File "some-file.txt"
WriteUninstaller "${SOME_DATA}\Uninstall.exe"
SectionEnd
Section "un.Remove InstallTest"
DetailPrint "Removing..."
;Delete Files
RMDir /r "${SOME_DATA}"
Delete "${SOME_DATA}\Uninstall.exe"
SectionEnd
我做错了什么?
答案 0 :(得分:0)
将Delete "$INSTDIR\Uninstall.exe"
放在RMDir
之前,而不是之后。
编辑:
如果某个其他程序有一个打开文件夹或文件夹内的东西,则RMDir将无法删除它。
在Windows上我会告诉你使用Sysinternals Process Monitor来查看删除失败的原因,我不知道这是否可以在WINE下运行,或者你的“主机操作系统”是否以某种方式阻止删除...... / p>