Changeset 209 for trunk/UCore.pas
- Timestamp:
- Sep 20, 2021, 12:25:22 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UCore.pas
r208 r209 49 49 InitializeStarted: Boolean; 50 50 InitializeFinished: Boolean; 51 function GetAppShareDir(Dir: string): string; 51 52 procedure Initialize; 52 53 procedure LoadConfig; … … 59 60 Core: TCore; 60 61 61 const62 DefaultRegKey = '\Software\Chronosoft\Acronym Decoder';63 64 62 65 63 implementation … … 82 80 83 81 procedure TCore.DataModuleCreate(Sender: TObject); 84 const 85 LinuxLanguagesDir = '/usr/share/AcronymDecoder/Languages'; 86 begin 87 {$IFDEF Linux} 88 // If installed in Linux system then use installation directory for po files 89 if not DirectoryExists(Translator.POFilesFolder) and DirectoryExists(LinuxLanguagesDir) then 90 Translator.POFilesFolder := LinuxLanguagesDir; 91 {$ENDIF} 82 begin 83 Translator.POFilesFolder := GetAppShareDir('Languages'); 92 84 93 85 AcronymDb := nil; … … 131 123 {$ENDIF} 132 124 WriteLn(Text); 125 end; 126 127 function TCore.GetAppShareDir(Dir: string): string; 128 var 129 NewDir: string; 130 begin 131 Result := ExtractFileDir(Application.ExeName) + DirectorySeparator + Dir; 132 {$IFDEF Linux} 133 // If installed in Linux system then try to use different installation directory 134 if not DirectoryExists(Result) then begin 135 NewDir := '/usr/share/' + ExtractFileNameOnly(Application.ExeName) + DirectorySeparator + Dir; 136 if DirectoryExists(NewDir) then Result := NewDir; 137 end; 138 {$ENDIF} 133 139 end; 134 140 … … 159 165 end; 160 166 161 ExamplesDir := ExtractFileDir(Application.ExeName) + DirectorySeparator + 162 'Examples'; 163 {$IFDEF Linux} 164 // If installed in Linux system then use installation directory for po files 165 if Application.ExeName = '/usr/bin/' + ExtractFileNameOnly(Application.ExeName) then 166 ExamplesDir := '/usr/share/' + ExtractFileNameOnly(Application.ExeName) + 167 DirectorySeparator + 'Examples'; 168 {$ENDIF} 167 ExamplesDir := GetAppShareDir('Examples'); 169 168 ExampleFileName := ExamplesDir + DirectorySeparator + ExampleFile; 170 169 … … 212 211 with TRegistryEx.Create do 213 212 try 214 RootKey := HKEY_CURRENT_USER;215 OpenKey( DefaultRegKey, True);213 RootKey := RegistryRootHKEY[ApplicationInfo1.RegistryRoot]; 214 OpenKey(ApplicationInfo1.RegistryKey, True); 216 215 ScaleDPI1.DPI := Point(ReadIntegerWithDefault('DPIX', 96), ReadIntegerWithDefault('DPIY', 96)); 217 216 ScaleDPI1.AutoDetect := ReadBoolWithDefault('DPIAuto', True); … … 234 233 with TRegistryEx.Create do 235 234 try 236 RootKey := HKEY_CURRENT_USER;237 OpenKey( DefaultRegKey, True);235 RootKey := RegistryRootHKEY[ApplicationInfo1.RegistryRoot]; 236 OpenKey(ApplicationInfo1.RegistryKey, True); 238 237 WriteInteger('DPIX', ScaleDPI1.DPI.X); 239 238 WriteInteger('DPIY', ScaleDPI1.DPI.Y);
Note:
See TracChangeset
for help on using the changeset viewer.