Changeset 648


Ignore:
Timestamp:
Feb 19, 2025, 9:43:42 AM (3 days ago)
Author:
chronos
Message:
  • Fixed: Tribes were not propertly detected in usr/share/c-evo directory.
Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Brain.pas

    r592 r648  
    8080  TextSize: TSize;
    8181begin
    82   if not LoadGraphicFile(Picture, GetAiDir + DirectorySeparator +
    83     FileName + DirectorySeparator + FileName + '.png', [gfNoError]) then begin
     82  if not LoadGraphicFile(Picture, GetAiDir + DirectorySeparator + FileName + DirectorySeparator + FileName + '.png', [gfNoError]) then begin
    8483    with Picture.Canvas do begin
    8584      Brush.Color := $904830;
  • trunk/LocalPlayer/Help.pas

    r647 r648  
    19821982      if Category = hkInternet then
    19831983        case Index of
    1984           1: OpenDocument(GetAppShareFile(AITemplateFileName));
     1984          1: OpenDocument(GetAppSharePath(AITemplateFileName));
    19851985          2: OpenURL(CevoHomepage);
    19861986          3: OpenURL(CevoContact);
  • trunk/LocalPlayer/TechTree.pas

    r647 r648  
    176176    Image := TBitmap.Create;
    177177    Image.PixelFormat := TPixelFormat.pf24bit;
    178     LoadGraphicFile(Image, GetAppShareFile('Help' + DirectorySeparator + 'AdvTree.png'),
     178    LoadGraphicFile(Image, GetAppSharePath('Help' + DirectorySeparator + 'AdvTree.png'),
    179179      [gfNoGamma]);
    180180
  • trunk/LocalPlayer/Term.pas

    r647 r648  
    13861386    if AILogo[P] = nil then
    13871387      AILogo[P] := TBitmap.Create;
    1388     if not LoadGraphicFile(AILogo[P], GetAppShareFile(Name + '.png'), [gfNoError]) then
     1388    if not LoadGraphicFile(AILogo[P], GetAppSharePath(Name + '.png'), [gfNoError]) then
    13891389    begin
    13901390      FreeAndNil(AILogo[P]);
  • trunk/Packages/CevoComponents/Directories.pas

    r647 r648  
    1515function GetSoundsDir: string;
    1616function GetAiDir: string;
    17 function GetAppShareDir(Dir: string): string;
    18 function GetAppShareFile(FileName: string): string;
     17function GetAppSharePath(Path: string): string;
    1918
    2019
     
    2423  FileUtil, LCLIntf, LCLType, LCLProc, LazUTF8, SysUtils, LazFileUtils, Forms;
    2524
    26 function GetAppShareDir(Dir: string): string;
     25function GetAppSharePath(Path: string): string;
    2726{$IFDEF UNIX}
    2827var
    29   NewDir: string;
     28  NewPath: string;
    3029{$ENDIF}
    3130begin
    32   Result := ExtractFileDir(Application.ExeName) + DirectorySeparator + Dir;
     31  Result := ExtractFileDir(Application.ExeName) + DirectorySeparator + Path;
    3332  {$IFDEF UNIX}
    3433  // If installed in Linux system then try to use different installation directory
    3534  if not DirectoryExists(Result) then begin
    36     NewDir := ExtractFileDir(Application.ExeName) + DirectorySeparator + '..' +
     35    NewPath := ExtractFileDir(Application.ExeName) + DirectorySeparator + '..' +
    3736      DirectorySeparator + 'share' + DirectorySeparator +
    38       ExtractFileNameOnly(Application.ExeName) + DirectorySeparator + Dir;
    39     if DirectoryExists(NewDir) then Result := NewDir;
     37      ExtractFileNameOnly(Application.ExeName) + DirectorySeparator + Path;
     38    if DirectoryExists(NewPath) then begin
     39      Result := NewPath;
     40      Exit;
     41    end;
    4042  end;
    41   {$ENDIF}
    42 end;
    43 
    44 function GetAppShareFile(FileName: string): string;
    45 {$IFDEF UNIX}
    46 var
    47   NewFile: string;
    48 {$ENDIF}
    49 begin
    50   Result := ExtractFileDir(Application.ExeName) + DirectorySeparator + FileName;
    51   {$IFDEF UNIX}
    52   // If installed in Linux system then try to use different installation directory
    5343  if not FileExists(Result) then begin
    54     NewFile := ExtractFileDir(Application.ExeName) + DirectorySeparator + '..' +
     44    NewPath := ExtractFileDir(Application.ExeName) + DirectorySeparator + '..' +
    5545      DirectorySeparator + 'share' + DirectorySeparator +
    56       ExtractFileNameOnly(Application.ExeName) + DirectorySeparator + FileName;
    57     if FileExists(NewFile) then Result := NewFile;
     46      ExtractFileNameOnly(Application.ExeName) + DirectorySeparator + Path;
     47    if FileExists(NewPath) then begin
     48      Result := NewPath;
     49      Exit;
     50    end;
    5851  end;
    5952  {$ENDIF}
     
    9487
    9588  if LocaleCode <> 'en' then begin
    96     Result := GetAppShareFile('Localization' + DirectorySeparator + LocaleCodeDir + DirectorySeparator + Path);
     89    Result := GetAppSharePath('Localization' + DirectorySeparator + LocaleCodeDir + DirectorySeparator + Path);
    9790    if not DirectoryExists(Result) and not FileExists(Result) then
    98       Result := GetAppShareFile(Path);
    99   end else Result := GetAppShareFile(Path);
     91      Result := GetAppSharePath(Path);
     92  end else Result := GetAppSharePath(Path);
    10093end;
    10194
     
    131124
    132125  AppDataDir := GetAppConfigDir(False);
    133   if AppDataDir = '' then DataDir := GetAppShareDir('')
     126  if AppDataDir = '' then DataDir := GetAppSharePath('')
    134127  else begin
    135128    if not DirectoryExists(AppDataDir) then ForceDirectories(AppDataDir);
     
    141134function GetSavedDir(Home: Boolean = False): string;
    142135begin
    143   if Home then Result := GetAppShareDir('Saved')
     136  if Home then Result := GetAppSharePath('Saved')
    144137    else Result := DataDir + 'Saved';
    145138end;
     
    147140function GetMapsDir(Home: Boolean = False): string;
    148141begin
    149   if Home then Result := GetAppShareDir('Maps')
     142  if Home then Result := GetAppSharePath('Maps')
    150143    else Result := DataDir + 'Maps';
    151144end;
     
    153146function GetGraphicsDir: string;
    154147begin
    155   Result := GetAppShareDir('Graphics');
     148  Result := GetAppSharePath('Graphics');
    156149end;
    157150
    158151function GetSoundsDir: string;
    159152begin
    160   Result := GetAppShareDir('Sounds');
     153  Result := GetAppSharePath('Sounds');
    161154end;
    162155
    163156function GetAiDir: string;
    164157begin
    165   Result := GetAppShareDir('AI');
     158  Result := GetAppSharePath('AI');
    166159end;
    167160
  • trunk/Packages/CevoComponents/ScreenTools.pas

    r647 r648  
    16091609    else
    16101610    begin
    1611       Phrases2.LoadFromFile(GetAppShareFile('Language2.txt'));
     1611      Phrases2.LoadFromFile(GetAppSharePath('Language2.txt'));
    16121612      Phrases2FallenBackToEnglish := True;
    16131613    end;
     
    16151615  else
    16161616  begin
    1617     Phrases.LoadFromFile(GetAppShareFile('Language.txt'));
    1618     Phrases2.LoadFromFile(GetAppShareFile('Language2.txt'));
     1617    Phrases.LoadFromFile(GetAppSharePath('Language.txt'));
     1618    Phrases2.LoadFromFile(GetAppSharePath('Language2.txt'));
    16191619  end;
    16201620
  • trunk/Start.pas

    r647 r648  
    235235
    236236  ActionsOffered := [maConfig, maManual, maCredits, maWeb];
    237   if FileExists(GetAppShareFile(AITemplateFileName)) then
     237  if FileExists(GetAppSharePath(AITemplateFileName)) then
    238238    Include(ActionsOffered, maAIDev);
    239239
     
    484484    for I := 1 to Languages.Count - 1 do
    485485    with Languages[I] do begin
    486       Available := DirectoryExists(GetAppShareDir('Localization' + DirectorySeparator + Code)) or (Code = 'en');
     486      Available := DirectoryExists(GetAppSharePath('Localization' + DirectorySeparator + Code)) or (Code = 'en');
    487487    end;
    488488  end;
     
    15171517      maManual: DirectHelp(cStartHelp);
    15181518      maCredits: DirectHelp(cStartCredits);
    1519       maAIDev: OpenDocument(GetAppShareFile(AITemplateFileName));
     1519      maAIDev: OpenDocument(GetAppSharePath(AITemplateFileName));
    15201520      maWeb: OpenURL(CevoHomepage);
    15211521    end;
Note: See TracChangeset for help on using the changeset viewer.