Skip to content

Commit 16cf8ae

Browse files
committed
Now confirms for registry read game paths. #2
1 parent ca16a78 commit 16cf8ae

File tree

1 file changed

+25
-19
lines changed

1 file changed

+25
-19
lines changed

src/settings.pas

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
interface
66

77
uses
8-
Classes, SysUtils, Registry, jsonConf, Dialogs,
8+
Classes, SysUtils, Registry, jsonConf, Dialogs, Controls,
99
Common;
1010

1111
// Class to hold user settings and reading registry.
@@ -22,7 +22,7 @@ TSettings = class
2222

2323
//function GetMyDoc(): string;
2424
function GenReg( t: string ): string;
25-
function GetInstallDir(): string;
25+
function GetInstallDir: string;
2626

2727
// Property getter setters
2828
function GetGameDir(): string;
@@ -73,7 +73,7 @@ procedure TSettings.LoadConf();
7373
conf.Filename := json_fname; // created if NE. loads if E.
7474
end;
7575

76-
function TSettings.GetInstallDir(): string;
76+
function TSettings.GetInstallDir: string;
7777
var
7878
filename: string;
7979
diag: TOpenDialog;
@@ -86,26 +86,32 @@ function TSettings.GetInstallDir(): string;
8686
// If dir, returns False.
8787
if( FileExists( result ) ) then
8888
begin
89-
result := ExtractFilePath( result );
89+
// Ask user confirmation
90+
if MessageDlg( '확인', '다음 제로아워 경로가를 사용하겠습니까?:' + sLineBreak + result,
91+
mtConfirmation, [mbYes, mbNo],0) = mrYes
92+
then
93+
begin
94+
result := ExtractFilePath( result );
95+
exit;
96+
end
97+
else
98+
result := ''; // forget what we got
9099
end;
91100

92101
// Still, we might have failed to find Generals.
93-
// Then, let the user decide.
94-
if( result = '' ) then
95-
begin
96-
try
97-
diag := TOpenDialog.create( nil );
98-
diag.Options := [ofFileMustExist];
99-
diag.Filter := 'Exe파일|*.exe';
100-
if diag.Execute then
101-
begin
102-
filename := diag.Filename;
103-
result := ExtractFilePath( filename );
104-
end;
105-
finally
106-
diag.free;
102+
// Then, let the user find int.
103+
try
104+
diag := TOpenDialog.create( nil );
105+
diag.Options := [ofFileMustExist];
106+
diag.Filter := 'Exe파일|*.exe';
107+
if diag.Execute then
108+
begin
109+
filename := diag.Filename;
110+
result := ExtractFilePath( filename );
107111
end;
108-
end;
112+
finally
113+
diag.free;
114+
end;
109115
end;
110116

111117
procedure TSettings.SetGameDir(AValue: string);

0 commit comments

Comments
 (0)