Changeset 371


Ignore:
Timestamp:
Jan 2, 2025, 9:02:57 PM (2 days ago)
Author:
chronos
Message:
  • Modified: Improved base directory detection.
Location:
trunk
Files:
2 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
  • trunk/Install/flatpak/net.zdechov.app.xTactics.yml

    r370 r371  
    2727      - type: svn
    2828        url: https://svn.zdechov.net/xtactics/trunk
    29         revision: r370
     29        revision: r371
    3030    buildsystem: simple
    3131    build-commands:
     
    3333        . /usr/lib/sdk/freepascal/enable.sh
    3434        lazbuild --build-mode=Release --ws=qt5 xtactics.lpi
    35       - install -Dm755 xtactics -t $FLATPAK_DEST/share/xTactics
    36       - install -d $FLATPAK_DEST/bin
    37       - ln -s $FLATPAK_DEST/share/xTactics/xtactics $FLATPAK_DEST/bin/xtactics
     35      - install -Dm755 xtactics -t $FLATPAK_DEST/bin
    3836      - install -Dm644 Install/deb/xtactics.desktop -t $FLATPAK_DEST/share/applications
    3937      - install -Dm644 Install/deb/xtactics.xml $FLATPAK_DEST/share/mime/packages/$FLAPTAK_ID.xml
    40       - install -Dm644 Images/64x64/xtactics.png -t $FLATPAK_DEST/share/icons/hicolor/64x64/apps
    4138      - install -Dm644 Languages/*.po -t $FLATPAK_DEST/share/xtactics/Languages
    4239      - install -Dm644 Packages/Common/Languages/*.po -t $FLATPAK_DEST/share/xtactics/Languages
     
    4542      - install -d -m 755 $FLATPAK_DEST/share/xtactics/Images
    4643      - cp -r Images/Maps $FLATPAK_DEST/share/xtactics/Images
     44      - install -Dm644 Images/64x64/xtactics.png -t $FLATPAK_DEST/share/icons/hicolor/64x64/apps
    4745      - install -Dm644 Install/flatpak/${FLATPAK_ID}.metainfo.xml -t $FLATPAK_DEST/share/metainfo
Note: See TracChangeset for help on using the changeset viewer.