Quote:
Originally Posted by giruthanders
Hello, I would like to ask how I could make the setup remember the folder I install my games in, like FitGirl's?
The default is C:\Program Files, but for example I change it to D:\Games. I want the installer to remember so that the next game I install, it will default to that directory instead of going back to C.
|
FitGirl installers look for the next drive other than the drive the system is installed on and always install the game in a "Games" subfolder.
It doesn't memorize your last choice, it always installs in a "Games" folder and on the same drive.
Even if you choose "E:\My Games", assuming the system is installed on the "C:" drive in the next install it will suggest "D:\Games" as in the first install (Correct me if I'm wrong).
If you want similar behavior change the line in the
[Setup] section of the script.
Code:
from:
DefaultDirName={#DefaultDir}\{#GameName}
to:
DefaultDirName={code:NoSD}\Games\{#GameName}
Then paste this code below into the
[ Code] section of the script.
Code:
const
DRIVE_FIXED = 3;
function GetLogicalDriveStrings(nLenDrives: DWORD; lpDrives: String): DWORD;
external '[email protected] stdcall delayload';
function GetDriveType(lpDisk: String): DWORD;
external '[email protected] stdcall delayload';
function NoSD(Param: String): String;
var
Drive: String;
Buffer: String;
begin
SetLength(Buffer, 255);
SetLength(Buffer, GetLogicalDriveStrings(254, Buffer));
Result := ExpandConstant('{sd}');
while Pos(#0, Buffer) > 0 do
begin
Drive := Copy(Buffer, 1, Pos(#0, Buffer) - 1);
if (GetDriveType(Drive) = DRIVE_FIXED) and (CompareText(Drive, ExpandConstant('{sd}\')) <> 0) then
begin
Result := RemoveBackslash(Drive);
Break;
end;
Delete(Buffer, 1, Pos(#0, Buffer));
end;
end;
I hope that's what you need.