推荐的库/宏,可在卸载时删除已安装的文件 [英] Recommended Library/Macro that Deletes Installed Files on Uninstallation

查看:104
本文介绍了推荐的库/宏,可在卸载时删除已安装的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您会建议使用哪个库或宏在运行卸载时仅删除已安装的文件?

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

我知道已经问过很多这类问题,但是我正在寻找有关最新和最容易使用的宏/库的建议.与过去一样,我使用发布在 NSIS网站上的旧宏进行命令行参数解析等操作,但遇到了问题代码和实现.

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.

我的理解是,到目前为止有2个(还有更多吗?):

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?

我希望能够仅通过指定文件夹X来安装文件(并且所有子文件都将被安装),然后卸载程序将删除文件夹X中的所有子文件,但保留所有创建的用户.

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.

例如:

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

推荐答案

我尝试了上述两种方法,但都没有为我工作. Advanced_Uninstall_Log可以很好地工作,但是对于我拥有的数据量来说,它在安装过程中增加了巨大的延迟.

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.

uninstall_only_installed_files不适用于使用文件/r进行递归安装.

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

我最终写了一个python脚本,该脚本创建了两个宏,InstallFiles和UninstallFiles.在使用MakeNSIS构建NSIS安装程序之前,我使用批处理文件调用此脚本并生成install_files.nsh.

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.

有人在这里张贴了他的类似剧本; http://nsis.sourceforge.net/Talk:Uninstall_only_installed_files

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

这篇关于推荐的库/宏,可在卸载时删除已安装的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆