Ignore:
Timestamp:
Jun 23, 2019, 3:15:29 PM (5 years ago)
Author:
chronos
Message:
  • Modified: Use DpiControls package for High DPI support.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/highdpi/Packages/CevoComponents/Directories.pas

    r169 r178  
    44
    55var
    6   HomeDir: string;
    7   DataDir: string;
     6  HomeDir, DataDir: string;
    87  LocaleCode: string = '';
    98  LocaleCodeAuto: string = '';
     
    1110function LocalizedFilePath(const Path: string): string;
    1211procedure InitUnit;
    13 function GetSavedDir(Home: Boolean = False): string;
    14 function GetMapsDir(Home: Boolean = False): string;
    1512
    1613
     
    7269  else
    7370  begin
    74     if not DirectoryExists(AppDataDir) then CreateDir(AppDataDir);
     71    if not DirectoryExists(AppDataDir) then
     72      CreateDir(AppDataDir);
    7573    DataDir := AppDataDir;
    7674  end;
    77   if not DirectoryExists(GetSavedDir) then CreateDir(GetSavedDir);
    78   if not DirectoryExists(GetMapsDir) then CreateDir(GetMapsDir);
     75  if not DirectoryExists(DataDir + 'Saved') then
     76    CreateDir(DataDir + 'Saved');
     77  if not DirectoryExists(DataDir + 'Maps') then
     78    CreateDir(DataDir + 'Maps');
    7979
    8080  // Copy appdata if not done yet
    81   if FindFirst(GetSavedDir(True) + DirectorySeparator + '*.cevo', $21, src) = 0 then
     81  if FindFirst(HomeDir + 'Saved' + DirectorySeparator + '*.cevo', $21, src) = 0 then
    8282    repeat
    83       if (FindFirst(GetSavedDir(True) + DirectorySeparator + src.Name, $21, dst) <> 0) or
     83      if (FindFirst(DataDir + 'Saved' + DirectorySeparator + src.Name, $21, dst) <> 0) or
    8484        (dst.Time < src.Time) then
    85         CopyFile(PChar(GetSavedDir(True) + DirectorySeparator + src.Name),
    86           PChar(GetSavedDir(True) + DirectorySeparator + src.Name), false);
     85        CopyFile(PChar(HomeDir + 'Saved' + DirectorySeparator + src.Name),
     86          PChar(DataDir + 'Saved' + DirectorySeparator + src.Name), false);
    8787      FindClose(dst);
    8888    until FindNext(src) <> 0;
     
    9090
    9191  // Copy appdata if not done yet
    92   if FindFirst(GetMapsDir(True) + DirectorySeparator + '*.*', $21, src) = 0 then
     92  if FindFirst(HomeDir + 'Maps' + DirectorySeparator + '*.*', $21, src) = 0 then
    9393    repeat
    94       if (FindFirst(GetMapsDir(True) + DirectorySeparator + src.Name, $21, dst) <> 0) or
     94      if (FindFirst(DataDir + 'Maps' + DirectorySeparator + src.Name, $21, dst) <> 0) or
    9595        (dst.Time < src.Time) then
    96         CopyFile(PChar(GetMapsDir(True) + DirectorySeparator + src.Name),
    97           PChar(GetMapsDir(True) + DirectorySeparator + src.Name), false);
     96        CopyFile(PChar(HomeDir + 'Maps' + DirectorySeparator + src.Name),
     97          PChar(DataDir + 'Maps' + DirectorySeparator + src.Name), false);
    9898      FindClose(dst);
    9999    until FindNext(src) <> 0;
     
    101101end;
    102102
    103 function GetSavedDir(Home: Boolean = False): string;
    104 begin
    105   if Home then Result := HomeDir + 'Saved'
    106     else Result := DataDir + 'Saved';
    107 end;
    108 
    109 function GetMapsDir(Home: Boolean = False): string;
    110 begin
    111   if Home then Result := HomeDir + 'Maps'
    112     else Result := DataDir + 'Maps';
    113 end;
    114 
    115103end.
Note: See TracChangeset for help on using the changeset viewer.