Changeset 713


Ignore:
Timestamp:
Jan 2, 2026, 10:51:00 PM (3 hours ago)
Author:
chronos
Message:
  • Modified: Code cleanup.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/CevoComponents/Directories.pas

    r664 r713  
    2222
    2323uses
    24   FileUtil, LCLIntf, LCLType, LCLProc, LazUTF8, SysUtils, LazFileUtils, Forms;
     24  FileUtil, LCLIntf, LCLType, LCLProc, LazUTF8, SysUtils, LazFileUtils, Forms,
     25  Translations;
    2526
    2627function GetAppSharePath(Path: string): string;
     
    3334  {$IFDEF UNIX}
    3435  // If installed in Linux system then try to use different installation directory
     36  NewPath := ExtractFileDir(Application.ExeName) + DirectorySeparator + '..' +
     37    DirectorySeparator + 'share' + DirectorySeparator +
     38    ExtractFileNameOnly(Application.ExeName) + DirectorySeparator + Path;
     39
    3540  if not DirectoryExists(Result) then begin
    36     NewPath := ExtractFileDir(Application.ExeName) + DirectorySeparator + '..' +
    37       DirectorySeparator + 'share' + DirectorySeparator +
    38       ExtractFileNameOnly(Application.ExeName) + DirectorySeparator + Path;
    3941    if DirectoryExists(NewPath) then begin
    4042      Result := NewPath;
     
    4244    end;
    4345  end;
     46
    4447  if not FileExists(Result) then begin
    45     NewPath := ExtractFileDir(Application.ExeName) + DirectorySeparator + '..' +
    46       DirectorySeparator + 'share' + DirectorySeparator +
    47       ExtractFileNameOnly(Application.ExeName) + DirectorySeparator + Path;
    4848    if FileExists(NewPath) then begin
    4949      Result := NewPath;
     
    5656function GetLocale: string;
    5757var
    58   Lang: string;
    5958  I: Integer;
    60   T: string;
     59  LanguageID: TLanguageID;
    6160begin
    6261  // Win32 user may decide to override locale with LANG variable.
    63   Lang := Copy(GetEnvironmentVariableUTF8('LANG'), 1, 2);
     62  Result := Copy(GetEnvironmentVariableUTF8('LANG'), 1, 2);
    6463
    65   if Lang = '' then begin
    66     for I := 1 to Paramcount - 1 do
     64  if Result = '' then begin
     65    for I := 1 to ParamCount - 1 do
    6766      if (ParamStrUTF8(I) = '--LANG') or (ParamStrUTF8(I) = '-l') or
    6867        (ParamStrUTF8(I) = '--lang') then
    69           Lang := ParamStrUTF8(I + 1);
     68          Result := ParamStrUTF8(I + 1);
    7069  end;
    71   if Lang = '' then begin
    72     T := '';
    73     LazGetLanguageIDs(Lang, T);
    74     Lang := Copy(Lang, 1, 2);
     70  if Result = '' then begin
     71    LanguageID := GetLanguageID;
     72    Result := Copy(LanguageID.LanguageID, 1, 2);
    7573  end;
    76 
    77   Result := Lang;
    7874end;
    7975
Note: See TracChangeset for help on using the changeset viewer.