获取虚拟商店路径? [英] Get the Virtual Store path?
本文介绍了获取虚拟商店路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在安装应用程序,并希望为ini文件设置值.不幸的是,我们的主应用程序仍然建立在重定向到虚拟商店的平台上.有没有办法让Inno Setup直接将ini文件存储在虚拟存储中?
I'm installing an application and want to set values for an ini file. Unfortunately, our main application is still built on a platform that gets redirected to the virtual store. Is there a way to get Inno Setup to store the ini file in the virtual store directly?
推荐答案
我相信甚至没有Windows API可以检索虚拟商店的路径,只允许使用Inno Setup可靠地对其进行检索.
I believe there's even no Windows API to retrieve the path to the virtual store, let only possibility to retrieve it reliably using 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;
您可能还应该检查路径是否在系统驱动器上.
You should probably also check that the path is on a system drive.
这篇关于获取虚拟商店路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文