mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-07 06:38:06 +02:00
ide: fixed overriding lazarusdir via cfg file
This commit is contained in:
parent
90584b2d07
commit
505c8d4619
14
ide/main.pp
14
ide/main.pp
@ -1266,17 +1266,15 @@ begin
|
||||
AddDefaultRecentProjects; // Add some initial recent projects.
|
||||
|
||||
// read language and lazarusdir parameters, needed for translation
|
||||
if Application.HasOption('language') then
|
||||
if GetParamOptionPlusValue('--language=',s) then
|
||||
begin
|
||||
debugln('Hint: (lazarus) [TMainIDE.LoadGlobalOptions] overriding language with command line: ',
|
||||
Application.GetOptionValue('language'));
|
||||
EnvironmentOptions.LanguageID := Application.GetOptionValue('language');
|
||||
debugln('Hint: (lazarus) [TMainIDE.LoadGlobalOptions] overriding language with command line: ',s);
|
||||
EnvironmentOptions.LanguageID := s;
|
||||
end;
|
||||
if Application.HasOption('lazarusdir') then
|
||||
if GetParamOptionPlusValue('--lazarusdir=',s) then
|
||||
begin
|
||||
debugln('Hint: (lazarus) [TMainIDE.LoadGlobalOptions] overriding Lazarusdir with command line: ',
|
||||
Application.GetOptionValue('lazarusdir'));
|
||||
EnvironmentOptions.Lazarusdirectory:= Application.GetOptionValue('lazarusdir');
|
||||
debugln('Hint: (lazarus) [TMainIDE.LoadGlobalOptions] overriding Lazarusdir with command line: ',s);
|
||||
EnvironmentOptions.Lazarusdirectory:= s;
|
||||
end;
|
||||
|
||||
// translate IDE resourcestrings
|
||||
|
@ -122,6 +122,7 @@ function ParamIsOption(ParamIndex : integer; const Option : string) : boolean; o
|
||||
function ParamIsOption(ParamIndex : integer; const OptionShort, OptionLong: string) : boolean; overload; // case insensitive
|
||||
function ParamIsOptionPlusValue(ParamIndex : integer;
|
||||
const Option : string; out AValue : string) : boolean;
|
||||
function GetParamOptionPlusValue(const Option: string; out AValue: string): boolean; overload; // case insensitive
|
||||
|
||||
procedure ParseNoGuiCmdLineParams;
|
||||
|
||||
@ -354,7 +355,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function GetCommandLineParameters(aCmdLineParams : TStrings; isStartLazarus : Boolean = False) : String;
|
||||
function GetCommandLineParameters(aCmdLineParams: TStrings; isStartLazarus: Boolean): string;
|
||||
var
|
||||
i: Integer;
|
||||
s: String;
|
||||
@ -475,6 +476,16 @@ begin
|
||||
AValue := '';
|
||||
end;
|
||||
|
||||
function GetParamOptionPlusValue(const Option: string; out AValue: string): boolean;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
AValue:='';
|
||||
for i:=1 to ParamsAndCfgCount do
|
||||
if ParamIsOptionPlusValue(i,Option,AValue) then exit(true);
|
||||
Result:=false;
|
||||
end;
|
||||
|
||||
procedure ParseNoGuiCmdLineParams;
|
||||
var
|
||||
i : integer;
|
||||
|
Loading…
Reference in New Issue
Block a user