获取虚拟商店路径?

时间:2015-03-03 21:55:39

标签: inno-setup virtualstore

我正在安装一个应用程序,并希望为ini文件设置值。不幸的是,我们的主应用程序仍然建立在一个可以重定向到虚拟商店的平台上。有没有办法让Inno Setup直接将ini文件存储在虚拟商店中?

1 个答案:

答案 0 :(得分: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;

您还应该检查路径是否在系统驱动器上。