目前可访问LocalLow
我用这个:
{%USERPROFILE}\AppData\LocalLow
但我想知道 Inno Setup 中是否有一个常数,因为两者Roaming
and Local
有一个。
没有常数AppData\LocalLow
.
您可以使用 Pascal 脚本来解决它。
要解决“LocalLow”问题,必须使用SHGetKnownFolderPath.
也可以看看检测AppData\LocalLow的位置.
由于缺乏(广泛的)PChar
输入 Unicode Inno Setup。
const
MAX_PATH = 260;
AppDataLocalLowGUID = '{A520A1A4-1780-4FF6-BD18-167343C5AF16}';
// There's no PChar in Unicode Inno Setup,
// pretend the function returns a pointer to an Integer
function SHGetKnownFolderPath(rfid: TGUID; dwFlags: DWORD; hToken: THandle;
var ppszPath: Integer): Integer;
external '[email protected] stdcall';
// And allow the Integer to be copied to string
function StrCpy(Dest: string; Source: Integer): Integer;
external '[email protected] stdcall';
// And allow the Integer pointer to be released
procedure CoTaskMemFreeAsInteger(pv: Integer);
external '[email protected] stdcall';
function GetAppDataLocalLow: string;
var
Path: Integer;
I: Integer;
begin
if SHGetKnownFolderPath(StringToGUID(AppDataLocalLowGUID), 0, 0, Path) = 0 then
begin
// The path should not be longer than MAX_PATH
SetLength(Result, MAX_PATH);
StrCpy(Result, Path);
CoTaskMemFreeAsInteger(Path);
// Look for NUL character and adjust the length accordingly
SetLength(Result, Pos(#0, Result) - 1);
end;
end;
如果您需要在非Code
部分(Pascal 脚本之外),您可以使用脚本常量:
[Files]
Source: myfile.txt; DestDir: {code:GetAppDataLocalLow}
并且您需要更改函数签名以采用虚拟参数:
function GetAppDataLocalLow(Param: string): string;
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)