Changeset 647
- Timestamp:
- Feb 19, 2025, 9:18:32 AM (3 days ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Install/appimage/AppRun
r645 r647 1 1 #!/bin/bash 2 exec $APPDIR/usr/ share/c-evo/c-evo2 exec $APPDIR/usr/bin/c-evo -
trunk/Install/appimage/build.sh
r645 r647 4 4 mv ../../AI/StdAI/libstdai.so ../../AI/StdAI/libstdai-amd64.so 5 5 lazbuild --build-mode=Release ../../Integrated.lpi 6 install -Dm755 ../../c-evo -t AppDir/usr/share/c-evo 7 install -d AppDir/usr/bin 8 ln -s $FLATPAK_DEST/share/c-evo/c-evo AppDir/usr/bin/c-evo 6 install -Dm755 ../../c-evo -t AppDir/usr/bin 9 7 install -Dm644 ../../Language.txt -t AppDir/usr/share/c-evo 10 8 install -Dm644 ../../Language2.txt -t AppDir/usr/share/c-evo -
trunk/LocalPlayer/Help.pas
r550 r647 1982 1982 if Category = hkInternet then 1983 1983 case Index of 1984 1: OpenDocument( HomeDir + AITemplateFileName);1984 1: OpenDocument(GetAppShareFile(AITemplateFileName)); 1985 1985 2: OpenURL(CevoHomepage); 1986 1986 3: OpenURL(CevoContact); -
trunk/LocalPlayer/TechTree.pas
r622 r647 176 176 Image := TBitmap.Create; 177 177 Image.PixelFormat := TPixelFormat.pf24bit; 178 LoadGraphicFile(Image, HomeDir + 'Help' + DirectorySeparator + 'AdvTree.png',178 LoadGraphicFile(Image, GetAppShareFile('Help' + DirectorySeparator + 'AdvTree.png'), 179 179 [gfNoGamma]); 180 180 -
trunk/LocalPlayer/Term.pas
r646 r647 1386 1386 if AILogo[P] = nil then 1387 1387 AILogo[P] := TBitmap.Create; 1388 if not LoadGraphicFile(AILogo[P], HomeDir + Name + '.png', [gfNoError]) then1388 if not LoadGraphicFile(AILogo[P], GetAppShareFile(Name + '.png'), [gfNoError]) then 1389 1389 begin 1390 1390 FreeAndNil(AILogo[P]); -
trunk/Packages/CevoComponents/Directories.pas
r447 r647 4 4 5 5 var 6 HomeDir: string;7 6 DataDir: string; 8 7 LocaleCode: string = ''; … … 16 15 function GetSoundsDir: string; 17 16 function GetAiDir: string; 17 function GetAppShareDir(Dir: string): string; 18 function GetAppShareFile(FileName: string): string; 18 19 19 20 … … 21 22 22 23 uses 23 FileUtil, LCLIntf, LCLType, LCLProc, LazUTF8, SysUtils; 24 FileUtil, LCLIntf, LCLType, LCLProc, LazUTF8, SysUtils, LazFileUtils, Forms; 25 26 function GetAppShareDir(Dir: string): string; 27 {$IFDEF UNIX} 28 var 29 NewDir: string; 30 {$ENDIF} 31 begin 32 Result := ExtractFileDir(Application.ExeName) + DirectorySeparator + Dir; 33 {$IFDEF UNIX} 34 // If installed in Linux system then try to use different installation directory 35 if not DirectoryExists(Result) then begin 36 NewDir := ExtractFileDir(Application.ExeName) + DirectorySeparator + '..' + 37 DirectorySeparator + 'share' + DirectorySeparator + 38 ExtractFileNameOnly(Application.ExeName) + DirectorySeparator + Dir; 39 if DirectoryExists(NewDir) then Result := NewDir; 40 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 53 if not FileExists(Result) then begin 54 NewFile := ExtractFileDir(Application.ExeName) + DirectorySeparator + '..' + 55 DirectorySeparator + 'share' + DirectorySeparator + 56 ExtractFileNameOnly(Application.ExeName) + DirectorySeparator + FileName; 57 if FileExists(NewFile) then Result := NewFile; 58 end; 59 {$ENDIF} 60 end; 24 61 25 62 function GetLocale: string; … … 57 94 58 95 if LocaleCode <> 'en' then begin 59 Result := HomeDir + 'Localization' + DirectorySeparator + LocaleCodeDir + DirectorySeparator + Path;96 Result := GetAppShareFile('Localization' + DirectorySeparator + LocaleCodeDir + DirectorySeparator + Path); 60 97 if not DirectoryExists(Result) and not FileExists(Result) then 61 Result := HomeDir + Path;62 end else Result := HomeDir + Path;98 Result := GetAppShareFile(Path); 99 end else Result := GetAppShareFile(Path); 63 100 end; 64 101 … … 92 129 begin 93 130 LocaleCode := ''; 94 HomeDir := ExtractFilePath(ParamStr(0));95 131 96 132 AppDataDir := GetAppConfigDir(False); 97 if AppDataDir = '' then DataDir := HomeDir133 if AppDataDir = '' then DataDir := GetAppShareDir('') 98 134 else begin 99 135 if not DirectoryExists(AppDataDir) then ForceDirectories(AppDataDir); … … 105 141 function GetSavedDir(Home: Boolean = False): string; 106 142 begin 107 if Home then Result := HomeDir + 'Saved'143 if Home then Result := GetAppShareDir('Saved') 108 144 else Result := DataDir + 'Saved'; 109 145 end; … … 111 147 function GetMapsDir(Home: Boolean = False): string; 112 148 begin 113 if Home then Result := HomeDir + 'Maps'149 if Home then Result := GetAppShareDir('Maps') 114 150 else Result := DataDir + 'Maps'; 115 151 end; … … 117 153 function GetGraphicsDir: string; 118 154 begin 119 Result := HomeDir + 'Graphics';155 Result := GetAppShareDir('Graphics'); 120 156 end; 121 157 122 158 function GetSoundsDir: string; 123 159 begin 124 Result := HomeDir + 'Sounds';160 Result := GetAppShareDir('Sounds'); 125 161 end; 126 162 127 163 function GetAiDir: string; 128 164 begin 129 Result := HomeDir + 'AI';165 Result := GetAppShareDir('AI'); 130 166 end; 131 167 -
trunk/Packages/CevoComponents/ScreenTools.pas
r608 r647 1609 1609 else 1610 1610 begin 1611 Phrases2.LoadFromFile( HomeDir + 'Language2.txt');1611 Phrases2.LoadFromFile(GetAppShareFile('Language2.txt')); 1612 1612 Phrases2FallenBackToEnglish := True; 1613 1613 end; … … 1615 1615 else 1616 1616 begin 1617 Phrases.LoadFromFile( HomeDir + 'Language.txt');1618 Phrases2.LoadFromFile( HomeDir + 'Language2.txt');1617 Phrases.LoadFromFile(GetAppShareFile('Language.txt')); 1618 Phrases2.LoadFromFile(GetAppShareFile('Language2.txt')); 1619 1619 end; 1620 1620 -
trunk/Start.pas
r622 r647 235 235 236 236 ActionsOffered := [maConfig, maManual, maCredits, maWeb]; 237 if FileExists( HomeDir + AITemplateFileName) then237 if FileExists(GetAppShareFile(AITemplateFileName)) then 238 238 Include(ActionsOffered, maAIDev); 239 239 … … 484 484 for I := 1 to Languages.Count - 1 do 485 485 with Languages[I] do begin 486 Available := DirectoryExists( HomeDir + 'Localization' + DirectorySeparator + Code) or (Code = 'en');486 Available := DirectoryExists(GetAppShareDir('Localization' + DirectorySeparator + Code)) or (Code = 'en'); 487 487 end; 488 488 end; … … 1517 1517 maManual: DirectHelp(cStartHelp); 1518 1518 maCredits: DirectHelp(cStartCredits); 1519 maAIDev: OpenDocument( HomeDir + AITemplateFileName);1519 maAIDev: OpenDocument(GetAppShareFile(AITemplateFileName)); 1520 1520 maWeb: OpenURL(CevoHomepage); 1521 1521 end;
Note:
See TracChangeset
for help on using the changeset viewer.