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更高效的任何建議,歡迎。