我正在安装一个应用程序并想为一个 ini 文件设置值。不幸的是,我们的主应用程序仍然构建在一个被重定向到虚拟商店的平台上。有没有办法让 Inno Setup 直接将 ini 文件存储在虚拟存储中?
1 回答
2
我相信甚至没有 Windows API 来检索虚拟商店的路径,只有使用 Inno Setup 可靠地检索它的可能性。
但你可以猜到它是{localappdata}\VirtualStore\path。
[Files]
Source: "MyProg.ini"; DestDir: "{code:GetVirtualStore|{app}}"
[Code]
function GetVirtualStore(Path: string): string;
var
Drive: string;
begin
Result := Path;
Drive := ExtractFileDrive(Path);
if CompareText(Drive, Copy(Path, 1, Length(Drive))) = 0 then
begin
Result := Copy(Result, Length(Drive) + 1, Length(Result) - Length(Drive));
Result := ExpandConstant('{localappdata}\VirtualStore') + Result;
end;
end;
您可能还应该检查该路径是否位于系统驱动器上。
于 2015-03-04T07:57:35.237 回答