1
Inno Setup是一个不错的易于使用的安装程序。它在this stackoverflow question中被评为高。我需要将插件安装到相对于第三方应用程序安装文件夹的文件夹中。从文档来看,如何做到这一点并不明显。如何使用Inno安装程序根据注册表项在文件夹中选择安装插件/文件?
Inno Setup是一个不错的易于使用的安装程序。它在this stackoverflow question中被评为高。我需要将插件安装到相对于第三方应用程序安装文件夹的文件夹中。从文档来看,如何做到这一点并不明显。如何使用Inno安装程序根据注册表项在文件夹中选择安装插件/文件?
您可以在文档和示例代码中找到如何使用注册表条目选择性安装文件的答案,但它可能并不明显,因此以下是一些使用Adobe Premiere插件的示例脚本片段作为示例:
的关键步骤是:
1)使用检查:参数
2)编写调用RegQueryStringValue的函数并解析路径来构造的相对插件文件夹目的地
3)使用{代码:}调用一个函数返回的目标文件夹
//
// Copy my plugin file to the Premiere Plugin folder, but only if Premiere is installed.
//
[Files]
Source: "C:\sourceFiles\myplugin.prm"; Check: GetPremierePluginDestination; DestDir: "{code:PluginDestination}"; Flags: ignoreversion overwritereadonly
[Code]
var sPluginDest : String;
//
// Search for the path where Premiere Pro was installed. Return true if path found.
// Set variable to plugin folder
//
function GetPremierePluginDestination(): Boolean;
var
i: Integer;
len: Integer;
begin
sPluginDest := '';
RegQueryStringValue(HKLM, 'SOFTWARE\Adobe\Premiere Pro\CurrentVersion', 'Plug-InsDir', sPluginDest);
len := Length(sPluginDest);
if len > 0 then
begin
i := len;
while sPluginDest[i] <> '\' do
begin
i := i-1;
end;
i := i+1;
Delete(sPluginDest, i, Len-i+1);
Insert('Common', sPluginDest, i);
end;
Result := len > 0;
end;
//
// Use this function to return path to install plugin
//
function PluginDestination(Param: String) : String;
begin
Result := sPluginDest;
end;
我不是一个程序员帕斯卡尔等使GetPremiereDestination更高效的任何建议,欢迎。