Changeset 648
- Timestamp:
- Feb 19, 2025, 9:43:42 AM (3 days ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Brain.pas
r592 r648 80 80 TextSize: TSize; 81 81 begin 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 84 83 with Picture.Canvas do begin 85 84 Brush.Color := $904830; -
trunk/LocalPlayer/Help.pas
r647 r648 1982 1982 if Category = hkInternet then 1983 1983 case Index of 1984 1: OpenDocument(GetAppShare File(AITemplateFileName));1984 1: OpenDocument(GetAppSharePath(AITemplateFileName)); 1985 1985 2: OpenURL(CevoHomepage); 1986 1986 3: OpenURL(CevoContact); -
trunk/LocalPlayer/TechTree.pas
r647 r648 176 176 Image := TBitmap.Create; 177 177 Image.PixelFormat := TPixelFormat.pf24bit; 178 LoadGraphicFile(Image, GetAppShare File('Help' + DirectorySeparator + 'AdvTree.png'),178 LoadGraphicFile(Image, GetAppSharePath('Help' + DirectorySeparator + 'AdvTree.png'), 179 179 [gfNoGamma]); 180 180 -
trunk/LocalPlayer/Term.pas
r647 r648 1386 1386 if AILogo[P] = nil then 1387 1387 AILogo[P] := TBitmap.Create; 1388 if not LoadGraphicFile(AILogo[P], GetAppShare File(Name + '.png'), [gfNoError]) then1388 if not LoadGraphicFile(AILogo[P], GetAppSharePath(Name + '.png'), [gfNoError]) then 1389 1389 begin 1390 1390 FreeAndNil(AILogo[P]); -
trunk/Packages/CevoComponents/Directories.pas
r647 r648 15 15 function GetSoundsDir: string; 16 16 function GetAiDir: string; 17 function GetAppShareDir(Dir: string): string; 18 function GetAppShareFile(FileName: string): string; 17 function GetAppSharePath(Path: string): string; 19 18 20 19 … … 24 23 FileUtil, LCLIntf, LCLType, LCLProc, LazUTF8, SysUtils, LazFileUtils, Forms; 25 24 26 function GetAppShare Dir(Dir: string): string;25 function GetAppSharePath(Path: string): string; 27 26 {$IFDEF UNIX} 28 27 var 29 New Dir: string;28 NewPath: string; 30 29 {$ENDIF} 31 30 begin 32 Result := ExtractFileDir(Application.ExeName) + DirectorySeparator + Dir;31 Result := ExtractFileDir(Application.ExeName) + DirectorySeparator + Path; 33 32 {$IFDEF UNIX} 34 33 // If installed in Linux system then try to use different installation directory 35 34 if not DirectoryExists(Result) then begin 36 New Dir:= ExtractFileDir(Application.ExeName) + DirectorySeparator + '..' +35 NewPath := ExtractFileDir(Application.ExeName) + DirectorySeparator + '..' + 37 36 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; 40 42 end; 41 {$ENDIF}42 end;43 44 function GetAppShareFile(FileName: string): string;45 {$IFDEF UNIX}46 var47 NewFile: string;48 {$ENDIF}49 begin50 Result := ExtractFileDir(Application.ExeName) + DirectorySeparator + FileName;51 {$IFDEF UNIX}52 // If installed in Linux system then try to use different installation directory53 43 if not FileExists(Result) then begin 54 New File:= ExtractFileDir(Application.ExeName) + DirectorySeparator + '..' +44 NewPath := ExtractFileDir(Application.ExeName) + DirectorySeparator + '..' + 55 45 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; 58 51 end; 59 52 {$ENDIF} … … 94 87 95 88 if LocaleCode <> 'en' then begin 96 Result := GetAppShare File('Localization' + DirectorySeparator + LocaleCodeDir + DirectorySeparator + Path);89 Result := GetAppSharePath('Localization' + DirectorySeparator + LocaleCodeDir + DirectorySeparator + Path); 97 90 if not DirectoryExists(Result) and not FileExists(Result) then 98 Result := GetAppShare File(Path);99 end else Result := GetAppShare File(Path);91 Result := GetAppSharePath(Path); 92 end else Result := GetAppSharePath(Path); 100 93 end; 101 94 … … 131 124 132 125 AppDataDir := GetAppConfigDir(False); 133 if AppDataDir = '' then DataDir := GetAppShare Dir('')126 if AppDataDir = '' then DataDir := GetAppSharePath('') 134 127 else begin 135 128 if not DirectoryExists(AppDataDir) then ForceDirectories(AppDataDir); … … 141 134 function GetSavedDir(Home: Boolean = False): string; 142 135 begin 143 if Home then Result := GetAppShare Dir('Saved')136 if Home then Result := GetAppSharePath('Saved') 144 137 else Result := DataDir + 'Saved'; 145 138 end; … … 147 140 function GetMapsDir(Home: Boolean = False): string; 148 141 begin 149 if Home then Result := GetAppShare Dir('Maps')142 if Home then Result := GetAppSharePath('Maps') 150 143 else Result := DataDir + 'Maps'; 151 144 end; … … 153 146 function GetGraphicsDir: string; 154 147 begin 155 Result := GetAppShare Dir('Graphics');148 Result := GetAppSharePath('Graphics'); 156 149 end; 157 150 158 151 function GetSoundsDir: string; 159 152 begin 160 Result := GetAppShare Dir('Sounds');153 Result := GetAppSharePath('Sounds'); 161 154 end; 162 155 163 156 function GetAiDir: string; 164 157 begin 165 Result := GetAppShare Dir('AI');158 Result := GetAppSharePath('AI'); 166 159 end; 167 160 -
trunk/Packages/CevoComponents/ScreenTools.pas
r647 r648 1609 1609 else 1610 1610 begin 1611 Phrases2.LoadFromFile(GetAppShare File('Language2.txt'));1611 Phrases2.LoadFromFile(GetAppSharePath('Language2.txt')); 1612 1612 Phrases2FallenBackToEnglish := True; 1613 1613 end; … … 1615 1615 else 1616 1616 begin 1617 Phrases.LoadFromFile(GetAppShare File('Language.txt'));1618 Phrases2.LoadFromFile(GetAppShare File('Language2.txt'));1617 Phrases.LoadFromFile(GetAppSharePath('Language.txt')); 1618 Phrases2.LoadFromFile(GetAppSharePath('Language2.txt')); 1619 1619 end; 1620 1620 -
trunk/Start.pas
r647 r648 235 235 236 236 ActionsOffered := [maConfig, maManual, maCredits, maWeb]; 237 if FileExists(GetAppShare File(AITemplateFileName)) then237 if FileExists(GetAppSharePath(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(GetAppShare Dir('Localization' + DirectorySeparator + Code)) or (Code = 'en');486 Available := DirectoryExists(GetAppSharePath('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(GetAppShare File(AITemplateFileName));1519 maAIDev: OpenDocument(GetAppSharePath(AITemplateFileName)); 1520 1520 maWeb: OpenURL(CevoHomepage); 1521 1521 end;
Note:
See TracChangeset
for help on using the changeset viewer.