Skip to content

Commit cda538c

Browse files
committed
Created option to disable Windows/OS path search
1 parent 591a07b commit cda538c

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

Core.pas

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ TVersionCondition = record
3939
function GetEnvironmentVariables() : TVStringList;
4040
function GetFilePaths() : TVStringList;
4141
function GetFilteredPaths() : TVStringList;
42+
function GetSkipOSPath() : Boolean;
4243
function GetMinVersion() : VString;
4344
function GetMaxVersion() : VString;
4445
function GetOptimalVersion() : VString;
@@ -651,7 +652,11 @@ procedure TParser.Process();
651652
begin
652653
ProcessRegistry(IsWOW64(FLogger));
653654
ProcessEnvironmentVariables();
654-
ProcessOSPath();
655+
if FSettings.GetSkipOSPath() then begin
656+
if (FLogger <> Nil) and (FLogger.IsDebug()) then
657+
FLogger.Log('Not looking for Java installations in OS path', TLogLevel.DEBUG);
658+
end
659+
else ProcessOSPath();
655660
ProcessFilePaths();
656661
ProcessFilteredPaths();
657662

NsJavaLocator.lpr

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ TParameters = class(TObject, TSettings)
4242
FEnvironmentVariables : TVStringList;
4343
FFilePaths : TVStringList;
4444
FFilteredPaths : TVStringList;
45+
FIsSkipOSPath : Boolean;
4546
FMinVersion : VString;
4647
FMaxVersion : VString;
4748
FOptimalVersion : VString;
@@ -57,6 +58,7 @@ TParameters = class(TObject, TSettings)
5758
function GetEnvironmentVariables() : TVStringList;
5859
function GetFilePaths() : TVStringList;
5960
function GetFilteredPaths() : TVStringList;
61+
function GetSkipOSPath() : Boolean;
6062
function GetMinVersion() : VString;
6163
function GetMaxVersion() : VString;
6264
function GetOptimalVersion() : VString;
@@ -68,6 +70,7 @@ TParameters = class(TObject, TSettings)
6870
property EnvironmentVariables : TVStringList read GetEnvironmentVariables;
6971
property FilePaths : TVStringList read GetFilePaths;
7072
property FilteredPaths : TVStringList read GetFilteredPaths;
73+
property IsSkipOSPath : Boolean read GetSkipOSPath;
7174
property MaxVersion : VString read GetMaxVersion;
7275
property MinVersion : VString read GetMinVersion;
7376
property OptimalVersion : VString read GetOptimalVersion;
@@ -188,6 +191,11 @@ function TParameters.GetFilteredPaths() : TVStringList;
188191
Result := FFilteredPaths;
189192
end;
190193

194+
function TParameters.GetSkipOSPath() : Boolean;
195+
begin
196+
Result := FIsSkipOSPath;
197+
end;
198+
191199
function TParameters.GetMinVersion() : VString;
192200
begin
193201
Result := FMinVersion;
@@ -241,6 +249,7 @@ procedure TParameters.ParseParams();
241249
poEnvDel = '/DELENVSTR';
242250
poFilterAdd = '/ADDFILTER';
243251
poFilterDel = '/DELFILTER';
252+
poSkipOSPath = '/SKIPOSPATH';
244253
poMinVer = '/MINVER';
245254
poMaxVer = '/MAXVER';
246255
poOptVer = '/OPTVER';
@@ -261,6 +270,7 @@ procedure TParameters.ParseParams();
261270
if parameterList[i][1] = '/' then begin
262271
if EqualStr(poLog, parameterList[i], False) then FIsLogging := True
263272
else if EqualStr(poDialogDebug, parameterList[i], False) then FIsDialogDebug := True
273+
else if EqualStr(poSkipOSPath, parameterList[i], False) then FIsSkipOSPath := True
264274

265275
// All value-less options must be handled before this point
266276
else if (i + 1 >= parameterList.Count) or (parameterList[i + 1][1] = '/') then begin
@@ -470,6 +480,7 @@ constructor TParameters.Create();
470480
// Only add filters that expand - otherwise they don't exist on the system
471481
if s <> StandardFilteredPaths[i] then FFilteredPaths.AddUnique(s, False);
472482
end;
483+
FIsSkipOSPath := False;
473484
FMinVersion := '';
474485
FMaxVersion := '';
475486
FOptimalVersion := '';

0 commit comments

Comments
 (0)