Ignore:
Timestamp:
May 21, 2020, 8:17:38 PM (4 years ago)
Author:
chronos
Message:
  • Modified: Update from trunk rev 245.
  • Modified: Vcl prefix/suffix changed to Native.
File:
1 edited

Legend:

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

    r210 r246  
    6363end;
    6464
     65procedure CopyDir(SourceDir, DestinationDir, Filter: string);
     66var
     67  Src, Dst: TSearchRec;
     68begin
     69  if not DirectoryExists(DestinationDir) then CreateDir(DestinationDir);
     70  if FindFirst(SourceDir + DirectorySeparator + Filter, $21, Src) = 0 then
     71    repeat
     72      if (FindFirst(DestinationDir + DirectorySeparator + Src.Name, $21, Dst) <> 0) or
     73        (Dst.Time < Src.Time) then
     74        CopyFile(SourceDir + DirectorySeparator + Src.Name,
     75          DestinationDir + DirectorySeparator + Src.Name, false);
     76      FindClose(Dst);
     77    until FindNext(Src) <> 0;
     78  FindClose(Src);
     79end;
     80
    6581procedure UnitInit;
    6682var
    6783  AppDataDir: string;
    68   src, dst: TSearchRec;
    6984begin
    7085  LocaleCode := '';
     
    7994    DataDir := AppDataDir;
    8095  end;
    81   if not DirectoryExists(GetSavedDir) then CreateDir(GetSavedDir);
    82   if not DirectoryExists(GetMapsDir) then CreateDir(GetMapsDir);
    8396
    84   // Copy appdata if not done yet
    85   if FindFirst(GetSavedDir(True) + DirectorySeparator + '*.cevo', $21, src) = 0 then
    86     repeat
    87       if (FindFirst(GetSavedDir(True) + DirectorySeparator + src.Name, $21, dst) <> 0) or
    88         (dst.Time < src.Time) then
    89         CopyFile(PChar(GetSavedDir(True) + DirectorySeparator + src.Name),
    90           PChar(GetSavedDir(True) + DirectorySeparator + src.Name), false);
    91       FindClose(dst);
    92     until FindNext(src) <> 0;
    93   FindClose(src);
    94 
    95   // Copy appdata if not done yet
    96   if FindFirst(GetMapsDir(True) + DirectorySeparator + '*.*', $21, src) = 0 then
    97     repeat
    98       if (FindFirst(GetMapsDir(True) + DirectorySeparator + src.Name, $21, dst) <> 0) or
    99         (dst.Time < src.Time) then
    100         CopyFile(PChar(GetMapsDir(True) + DirectorySeparator + src.Name),
    101           PChar(GetMapsDir(True) + DirectorySeparator + src.Name), false);
    102       FindClose(dst);
    103     until FindNext(src) <> 0;
    104   FindClose(src);
     97  CopyDir(GetSavedDir(True), GetSavedDir(False), '*.*');
     98  CopyDir(GetMapsDir(True), GetMapsDir(False), '*.*');
    10599end;
    106100
Note: See TracChangeset for help on using the changeset viewer.