Changeset 209


Ignore:
Timestamp:
Sep 20, 2021, 12:25:22 PM (3 years ago)
Author:
chronos
Message:
  • Fixed: Correctly detect data application directories for Linux installation.
  • Modified: Use registry key and root from application info component.
Location:
trunk
Files:
2 deleted
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormCheck.pas

    r207 r209  
    724724  with TRegistryEx.Create do
    725725  try
    726     RootKey := HKEY_CURRENT_USER;
    727     OpenKey(DefaultRegKey, True);
     726    RootKey := RegistryRootHKEY[Core.ApplicationInfo1.RegistryRoot];
     727    OpenKey(Core.ApplicationInfo1.RegistryKey, True);
    728728    EditSummaryStart.Text := ReadStringWithDefault('SummaryStart', 'ACRONYMS AND ABBREVIATIONS');
    729729    EditSummaryEnd.Text := ReadStringWithDefault('SummaryEnd', 'Appendix');
     
    739739  with TRegistryEx.Create do
    740740  try
    741     RootKey := HKEY_CURRENT_USER;
    742     OpenKey(DefaultRegKey, True);
     741    RootKey := RegistryRootHKEY[Core.ApplicationInfo1.RegistryRoot];
     742    OpenKey(Core.ApplicationInfo1.RegistryKey, True);
    743743    WriteString('SummaryStart', EditSummaryStart.Text);
    744744    WriteString('SummaryEnd', EditSummaryEnd.Text);
  • trunk/Forms/UFormMain.pas

    r208 r209  
    735735  if Title <> '' then Title := Title + ' - ';
    736736  Title := Title + Core.ApplicationInfo1.AppName;
     737  {$IFDEF WINDOWS}
     738  // Under Linux title would affect reg.xml path for storing registry settings
    737739  Application.Title := Title;
     740  {$ENDIF}
    738741  Caption := Title;
    739742  if Assigned(Core.AcronymDb) then begin
     
    750753procedure TFormMain.LoadConfig;
    751754begin
    752   RegistryContext := TRegistryContext.Create(HKEY_CURRENT_USER, DefaultRegKey);
    753   Core.PersistentForm1.RegistryContext := RegistryContext;
    754   RegistryContext := TRegistryContext.Create(HKEY_CURRENT_USER, DefaultRegKey + '\RecentFiles');
     755  Core.PersistentForm1.RegistryContext := Core.ApplicationInfo1.GetRegistryContext;
     756  RegistryContext := TRegistryContext.Create(Core.ApplicationInfo1.RegistryRoot,
     757    Core.ApplicationInfo1.RegistryKey + '\RecentFiles');
    755758  LastOpenedList1.LoadFromRegistry(RegistryContext);
    756759
     
    763766  with TRegistryEx.Create do
    764767  try
    765     RootKey := HKEY_CURRENT_USER;
    766     OpenKey(DefaultRegKey, True);
     768    RootKey := RegistryRootHKEY[Core.ApplicationInfo1.RegistryRoot];
     769    OpenKey(Core.ApplicationInfo1.RegistryKey, True);
    767770    AFilterSameLength.Checked := ReadBoolWithDefault('SameLength', False);
    768771    AFilterSameLetterCase.Checked := ReadBoolWithDefault('SameLetterCase', False);
     
    789792procedure TFormMain.SaveConfig;
    790793begin
    791   RegistryContext := TRegistryContext.Create(HKEY_CURRENT_USER, DefaultRegKey + '\RecentFiles');
     794  RegistryContext := TRegistryContext.Create(Core.ApplicationInfo1.RegistryRoot,
     795    Core.ApplicationInfo1.RegistryKey + '\RecentFiles');
    792796  LastOpenedList1.SaveToRegistry(RegistryContext);
    793797
    794798  with TRegistryEx.Create do
    795799  try
    796     RootKey := HKEY_CURRENT_USER;
    797     OpenKey(DefaultRegKey, True);
     800    RootKey := RegistryRootHKEY[Core.ApplicationInfo1.RegistryRoot];
     801    OpenKey(Core.ApplicationInfo1.RegistryKey, True);
    798802    WriteBool('SameLength', AFilterSameLength.Checked);
    799803    WriteBool('SameLetterCase', AFilterSameLetterCase.Checked);
  • trunk/Packages/Common/Languages/UFormAbout.cs.po

    r207 r209  
    2424msgstr "Verze"
    2525
     26#: tformabout.buttonhomepage.caption
     27msgid "Home page"
     28msgstr "Domovská stránka"
     29
     30#: tformabout.buttonclose.caption
     31msgid "Close"
     32msgstr "Zavřít"
  • trunk/Packages/Common/Languages/UFormAbout.po

    r207 r209  
    1414msgstr ""
    1515
     16#: tformabout.buttonhomepage.caption
     17msgid "Home page"
     18msgstr ""
     19
     20#: tformabout.buttonclose.caption
     21msgid "Close"
     22msgstr ""
     23
  • trunk/Packages/Common/Languages/UJobProgressView.po

    r204 r209  
    1414msgstr ""
    1515
     16#: ujobprogressview.soperations
     17msgid "Operations:"
     18msgstr ""
     19
    1620#: ujobprogressview.spleasewait
    1721msgid "Please wait..."
  • trunk/Packages/Common/Languages/UThreading.po

    r203 r209  
    33
    44#: uthreading.scurrentthreadnotfound
    5 #, fuzzy,badformat
    65msgid "Current thread ID %d not found in virtual thread list."
    76msgstr "Content-Type: text/plain; charset=UTF-8Content-Type: text/plain; charset=UTF-8Content-Type: text/plain; charset=UTF-8Content-Type: text/plain; charset=UTF-8Content-Type: text/plain; charset=UTF-8Content-Type: text/plain; charset=UTF-8Content-Type: text/plain; charset=UTF-8Content-Type: text/plain; charset=UTF-8Content-Type: text/plain; charset=UTF-8Content-Type: text/plain; charset=UTF-8Content-Type: text/plain; charset=UTF-8Content-Type: text/plain; charset=UTF-8Content-Type: text/plain; charset=UTF-8Content-Type: text/plain; charset=UTF-8Content-Type: text/plain; charset=UTF-8Content-Type: text/plain; charset=UTF-8"
  • trunk/UCore.lfm

    r207 r209  
    34773477    Description = 'A simple tool for quick searching of meaning for various acronyms and abbreviations.'
    34783478    ReleaseDate = 44322
    3479     RegistryKey = '\Software\Chronosoft\AcronymDecoder'
     3479    RegistryKey = '\Software\Chronosoft\Acronym Decoder'
    34803480    RegistryRoot = rrKeyCurrentUser
    34813481    License = 'CC0'
  • trunk/UCore.pas

    r208 r209  
    4949    InitializeStarted: Boolean;
    5050    InitializeFinished: Boolean;
     51    function GetAppShareDir(Dir: string): string;
    5152    procedure Initialize;
    5253    procedure LoadConfig;
     
    5960  Core: TCore;
    6061
    61 const
    62   DefaultRegKey = '\Software\Chronosoft\Acronym Decoder';
    63 
    6462
    6563implementation
     
    8280
    8381procedure 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}
     82begin
     83  Translator.POFilesFolder := GetAppShareDir('Languages');
    9284
    9385  AcronymDb := nil;
     
    131123  {$ENDIF}
    132124  WriteLn(Text);
     125end;
     126
     127function TCore.GetAppShareDir(Dir: string): string;
     128var
     129  NewDir: string;
     130begin
     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}
    133139end;
    134140
     
    159165    end;
    160166
    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');
    169168    ExampleFileName := ExamplesDir + DirectorySeparator + ExampleFile;
    170169
     
    212211  with TRegistryEx.Create do
    213212  try
    214     RootKey := HKEY_CURRENT_USER;
    215     OpenKey(DefaultRegKey, True);
     213    RootKey := RegistryRootHKEY[ApplicationInfo1.RegistryRoot];
     214    OpenKey(ApplicationInfo1.RegistryKey, True);
    216215    ScaleDPI1.DPI := Point(ReadIntegerWithDefault('DPIX', 96), ReadIntegerWithDefault('DPIY', 96));
    217216    ScaleDPI1.AutoDetect := ReadBoolWithDefault('DPIAuto', True);
     
    234233  with TRegistryEx.Create do
    235234  try
    236     RootKey := HKEY_CURRENT_USER;
    237     OpenKey(DefaultRegKey, True);
     235    RootKey := RegistryRootHKEY[ApplicationInfo1.RegistryRoot];
     236    OpenKey(ApplicationInfo1.RegistryKey, True);
    238237    WriteInteger('DPIX', ScaleDPI1.DPI.X);
    239238    WriteInteger('DPIY', ScaleDPI1.DPI.Y);
Note: See TracChangeset for help on using the changeset viewer.