Quote:
Originally Posted by Proxson
Hi ppl,
is there a constant for Users\Username\Saved Games ? I want to delete a folder in Saved Games but to no avail. I can't find that constant on the net.
I tried:
{Userprofile}\Saved Games
{%Userprofile%}\Saved Games
%Userprofile%\Saved Games
{Username}\Saved Games
Edit: The only way is writing down the full path in Setup.ini which is SaveGameFolder3=C:\Users\*****\Saved Games\
Not a very happy solution. I can't believe that the Inno Setup developer didn't include such constant.
|
There is no native constant in Inno Setup for the "Saved Games" folder.
You can use something like this:
Code:
function UpdateConstant(const S: String): String;
var
strDocs: String;
strSaves: String;
begin
Result := ExpandConstantEx(S, 'savedgames', ExpandConstant('{userdocs}\My Games'));
if (GetWindowsVersion shr 24 >= 6) and (Result = ExpandConstant('{userdocs}\My Games')) then
begin
RegQueryStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{F42EE2D3-909F-4907-8871-4C22FC0BF756}', 'RelativePath', strDocs);
RegQueryStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{4C5C32FF-BB9D-43b0-B5B4-2D72E54EAAA4}', 'RelativePath', strSaves);
StringChangeEx(Result, '\' + strDocs + '\My Games', '\' + strSaves, True);
end;
end;
This function also expands the other constants normally:
>> MsgBox(UpdateConstant('{userdocs}'), mbInformation, MB_OK); {expands normally}
>> MsgBox(UpdateConstant('{savedgames}'), mbInformation, MB_OK);
Remembering that CIU already has an UpdateConstant function.
If it is to be used in the CIU script, change the function name such as UpdateConstant2.