Changeset 371 for trunk/Core.pas


Ignore:
Timestamp:
Jan 2, 2025, 9:02:57 PM (4 days ago)
Author:
chronos
Message:
  • Modified: Improved base directory detection.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Core.pas

    r370 r371  
    7474    GameLoaded: Boolean;
    7575    FormNewTabIndex: Integer;
    76     GameFilesDir: string;
     76    BaseDir: string;
    7777    procedure LoadRecentExecute(Sender: TObject);
    7878    procedure StartNewGame;
     
    518518
    519519procedure TCore.DataModuleCreate(Sender: TObject);
    520 {$IFDEF Linux}
     520{$IFDEF UNIX}
    521521const
    522   LinuxGameFilesDir = '/usr/share/xtactics';
    523   LinuxLanguagesDir = LinuxGameFilesDir + '/Languages';
     522  LinuxBaseDir = '/usr/share/xtactics';
     523  LinuxLanguagesDir = LinuxBaseDir + '/Languages';
     524  LinuxBaseDir2 = '/app/share/xtactics';
     525  LinuxLanguagesDir2 = LinuxBaseDir2 + '/Languages';
    524526{$ENDIF}
    525527begin
    526   GameFilesDir := ExtractFilePath(ParamStr(0));
    527   {$IFDEF Linux}
     528  BaseDir := ExtractFilePath(ParamStr(0));
     529  Translator1.POFilesFolder := BaseDir + DirectorySeparator + 'Languages';
     530
     531  {$IFDEF UNIX}
    528532  // If installed in Linux system then use installation shared game directory for data files
    529   if DirectoryExists(LinuxGameFilesDir) then
    530     GameFilesDir := LinuxGameFilesDir;
     533  if not DirectoryExists(BaseDir) and DirectoryExists(LinuxBaseDir) then
     534    BaseDir := LinuxBaseDir;
     535
     536  if not DirectoryExists(BaseDir) and DirectoryExists(LinuxBaseDir2) then
     537    BaseDir := LinuxBaseDir2;
     538
    531539  // If installed in Linux system then use installation directory for po files
    532540  if not DirectoryExists(Translator1.POFilesFolder) and DirectoryExists(LinuxLanguagesDir) then
    533541    Translator1.POFilesFolder := LinuxLanguagesDir;
     542  if not DirectoryExists(Translator1.POFilesFolder) and DirectoryExists(LinuxLanguagesDir2) then
     543    Translator1.POFilesFolder := LinuxLanguagesDir2;
    534544  {$ENDIF}
    535545
     
    544554  Game.OnNewTurn := GameNewTurnExecute;
    545555  Game.OnPlayerChange := DoPlayerChange;
    546   Game.MapImageFileName := CombinePaths(GameFilesDir, 'Images' + DirectorySeparator + 'Maps' + DirectorySeparator + 'WorldMap.png');
     556  Game.MapImageFileName := CombinePaths(BaseDir, 'Images' + DirectorySeparator + 'Maps' + DirectorySeparator + 'WorldMap.png');
    547557  Server.Game := Game;
    548558  LocalClients.Game := Game;
     
    674684  DefaultGameSystemName = 'Default';
    675685begin
    676   if GameFilesDir <> '' then
    677     SystemsDir := GameFilesDir + DirectorySeparator + GameSystemsDirName
     686  if BaseDir <> '' then
     687    SystemsDir := BaseDir + DirectorySeparator + GameSystemsDirName
    678688    else SystemsDir := ExpandFileName(GameSystemsDirName);
    679689  if DirectoryExists(SystemsDir) then begin
Note: See TracChangeset for help on using the changeset viewer.