Recommended Library/Macro that Deletes Installed Files on Uninstallation

瘦欲@ 提交于 2019-12-25 18:18:50

问题


Which library or macro that deletes only installed files when the uninstallation is run would you recommend?

I'm aware this kind question has been asked alot but I'm looking for advice on the most current and easiest to use macro/library. As in the past,I used old macros that were posted on NSIS Website for things like Command Line Argument parsing and had problems with the code and implementation.

My understanding is that there are 2 so far(are there more?):

Advanced_Uninstall_Log
Uninstall_only_installed_files

Which library or single macro do you use and recommend?

I am hoping that I am able to install files by only specifying a folder X(and all its sub files will be installed) and the uninstaller will then delete all the subfiles in folder X but leave any the user created.

For eg:

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

回答1:


I tried both of the above mentioned, and neither worked for me. The Advanced_Uninstall_Log worked well, but for the amount of data I had it added a huge delay during the install.

The uninstall_only_installed_files isn't for doing recursive install with file /r.

I ended up writing a python script that created two macros, InstallFiles and UninstallFiles. I use a batch file to call this script and generate an install_files.nsh prior to building the NSIS installer with MakeNSIS.

Someone posted his similar script here; http://nsis.sourceforge.net/Talk:Uninstall_only_installed_files



来源:https://stackoverflow.com/questions/16270931/recommended-library-macro-that-deletes-installed-files-on-uninstallation

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!