2013-04-29 90 views
-1

您建議在卸載時只刪除已安裝文件的庫或宏?在卸載時刪除已安裝文件的推薦庫/宏

我知道這種問題已被問很多,但我正在尋找關於最新和最容易使用宏/庫的建議。和以前一樣,我使用了在NSIS Website上發佈的舊宏,用於命令行參數解析等問題,並且存在代碼和實現方面的問題。

我的理解是,有2到目前爲止,(有沒有更多?):

Advanced_Uninstall_Log
Uninstall_only_installed_files

哪個庫或單宏你使用和推薦嗎?

我希望能夠通過只指定文件夾X(及其所有子文件將被安裝)來安裝文件,然後卸載程序將刪除文件夾X中的所有子文件,但保留任何創建的用戶。

對於如:

Section "install" 
    File \r "FolderX" 

    # note how I dont do this.. 
    File \r "FolderX\filea.txt" 
    File \r "FolderX\fileb.txt" 
SectionEnd 

Section "un.uninstall" 
    ${RemoveDir} "FolderX" 

    # The above hypothetical function will hopefully only delete the files in FolderX that I installed. 
    Delete \r "FolderX\filea.txt" 
    Delete \r "FolderX\fileb.txt" 
SectionEnd 

回答

0

我都嘗試了上述的,也不爲我工作。 Advanced_Uninstall_Log運行良好,但對於數據量來說,它在安裝過程中增加了很大的延遲。

uninstall_only_installed_files不適用於使用file/r進行遞歸安裝。

我寫了一個python腳本,它創建了兩個宏InstallFiles和UninstallFiles。我使用批處理文件調用此腳本,並在使用MakeNSIS構建NSIS安裝程序之前生成install_files.nsh。

有人在這裏發佈了他的類似腳本; http://nsis.sourceforge.net/Talk:Uninstall_only_installed_files