简体   繁体   English

InnoSetup如何确定卸载程序中的自定义目录路径?

[英]InnoSetup How to determine custom dir path in uninstaller?

I'm creating custom dir in [Dirs] section. 我在[目录]部分中创建自定义目录。 as defined below: 定义如下:

[Dirs]
Name: {code:WrkGetWorkingDir}; Flags: uninsalwaysuninstall

[Code]
function WrkGetWorkingDir( Param: String ): String;
begin
Result := WrkOptionsPage3.Values[0];
end;

In Uninstaller I want to determine somehow that dir path and use it to access some file inside it before it will be deleted. 在卸载程序中,我想以某种方式确定该目录路径,并使用它来访问其中的某些文件,然后再将其删除。 WrkGetWorkingDir call is failing in uninstaller. WrkGetWorkingDir调用在卸载程序中失败。 Is it possible to store that path in some magic InnoSetup variable (or section) or I should store it in Registry or my custom file? 是否可以将该路径存储在一些不可思议的InnoSetup变量(或部分)中,或者应该将其存储在注册表或自定义文件中?

Yes. 是。 Read up on RegisterPreviousData , SetPreviousData , and GetPreviousData . 阅读RegisterPreviousDataSetPreviousDataGetPreviousData

You may also want to have a look at the CodeDlg.iss example script and some examples on the wiki . 您可能还想看看CodeDlg.iss示例脚本和Wiki上的一些示例

Another alternative is to have the uninstaller read it out of some file or registry setting already written at install time for your application to use. 另一种选择是让卸载程序从安装时已经写入的某些文件或注册表设置中读取它,以供您的应用程序使用。

Finally, however: you should be very careful about setting up deletes for user-entered paths (or indeed complete dir+file deletes for any path at all) -- some users may accidentally set this to somewhere unexpected that they don't actually want to have deleted. 最后,但是:您应该非常小心地设置用户输入的路径的删除(或者实际上完全删除所有路径的dir + file删除)-有些用户可能会不小心将其设置为他们实际不需要的意外位置已删除。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM