Changeset 184


Ignore:
Timestamp:
Jan 14, 2025, 11:19:27 AM (9 days ago)
Author:
chronos
Message:
  • Fixed: Data directories detection on Linux.
Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Core.lfm

    r181 r184  
    545545  end
    546546  object Translator: TTranslator
    547     POFilesFolder = 'Languages'
     547    POFilesFolder = 'Languages;Packages/Common/Languages'
    548548    OnTranslate = TranslatorTranslate
    549549    Left = 108
  • trunk/Core.pas

    r181 r184  
    3838    procedure TargetMessageExecute(Text: string);
    3939  public
    40     DataDir: string;
     40    BaseDir: string;
     41    ExamplesDir: string;
    4142    Project: TProject;
    4243    Targets: TTargets;
     
    6566  Core: TCore;
    6667
     68const
     69  ExamplesDirName = 'Examples';
     70  LanguagesDirName = 'Languages';
     71
    6772
    6873implementation
     
    9499{$IFDEF UNIX}
    95100const
    96   LinuxDataDir = '/usr/share/LazFuck';
    97   LinuxLanguagesDir = LinuxDataDir + '/Languages';
     101  LinuxDataDir = '../share/LazFuck';
     102var
     103  NewDir: string;
    98104{$ENDIF}
    99105begin
    100   DataDir := '';
     106  BaseDir := ExcludeTrailingPathDelimiter(ExtractFilePath(ParamStr(0)));
     107  Translator.POFilesFolder := BaseDir + DirectorySeparator + LanguagesDirName;
     108  ExamplesDir := BaseDir + DirectorySeparator + ExamplesDirName;
     109
    101110  {$IFDEF UNIX}
    102   // If installed in Linux system then use installation shared game directory for data files
    103   if DirectoryExists(LinuxDataDir) then
    104     DataDir := LinuxDataDir
    105     else DataDir := GetCurrentDir;
    106111  // If installed in Linux system then use installation directory for po files
    107   if not DirectoryExists(Translator.POFilesFolder) and DirectoryExists(LinuxLanguagesDir) then
    108     Translator.POFilesFolder := LinuxLanguagesDir;
     112  NewDir := ExpandFileName(BaseDir + DirectorySeparator + LinuxDataDir +
     113    DirectorySeparator + LanguagesDirName);
     114  if not DirectoryExists(Translator.POFilesFolder) and DirectoryExists(NewDir) then
     115    Translator.POFilesFolder := NewDir;
     116
     117  // If installed in Linux system then use installation directory for po files
     118  NewDir := ExpandFileName(BaseDir + DirectorySeparator + LinuxDataDir +
     119    DirectorySeparator + ExamplesDirName);
     120  if not DirectoryExists(ExamplesDir) and DirectoryExists(NewDir) then
     121    ExamplesDir := NewDir;
    109122  {$ENDIF}
    110123
  • trunk/Forms/FormMain.pas

    r175 r184  
    206206  SFileNotFound = 'File %s not found.';
    207207
    208 const
    209   ExamplesDir = 'Examples';
    210 
    211208{ TFormMain }
    212209
     
    217214  try
    218215    if Core.Core.LastOpenedList.Items.Count = 0 then
    219       Core.Core.LastOpenedList.Items.Add(CombinePaths(Core.Core.DataDir, ExamplesDir +
    220       DirectorySeparator + 'Sierpinski.b'));
     216      Core.Core.LastOpenedList.Items.Add(Core.Core.ExamplesDir +
     217        DirectorySeparator + 'Sierpinski.b');
    221218
    222219    if Core.Core.OpenProjectOnStart and (Core.Core.LastOpenedList.Items.Count > 0) and
     
    751748  AProjectClose.Execute;
    752749  if Core.Core.Project.Openned then Exit;
    753   Core.Core.Project.FileName := CombinePaths(Core.Core.DataDir, ExamplesDir + DirectorySeparator + SNewProject + '.b');
     750  Core.Core.Project.FileName := SNewProject + '.b';
     751  Core.Core.Project.Openned := True;
    754752  FormSourceCode.SynEditSource.Clear;
    755   Core.Core.Project.Openned := True;
    756753  Core.Core.CurrentTarget.Compiled := False;
    757754  UpdateInterface;
  • trunk/Install/flatpak/net.zdechov.app.LazFuck.yml

    r183 r184  
    2727      - type: svn
    2828        url: https://svn.zdechov.net/LazFuck/trunk
    29         revision: r183
     29        revision: r184
    3030    buildsystem: simple
    3131    build-commands:
     
    3535      - install -Dm755 LazFuck -t $FLATPAK_DEST/bin
    3636      - install -Dm644 Install/deb/LazFuck.desktop -t $FLATPAK_DEST/share/applications
    37       - install -Dm644 Images/256x256/LazFuck.png $FLATPAK_DEST/share/icons/hicolor/256x256/apps
     37      - install -Dm644 Images/256x256/LazFuck.png -t $FLATPAK_DEST/share/icons/hicolor/256x256/apps
    3838      - install -Dm644 Languages/*.po -t $FLATPAK_DEST/share/LazFuck/Languages
    3939      - install -Dm644 Packages/Common/Languages/*.po -t $FLATPAK_DEST/share/LazFuck/Languages
Note: See TracChangeset for help on using the changeset viewer.