Changeset 246 for branches/highdpi/Packages/CevoComponents/Directories.pas
- Timestamp:
- May 21, 2020, 8:17:38 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/highdpi/Packages/CevoComponents/Directories.pas
r210 r246 63 63 end; 64 64 65 procedure CopyDir(SourceDir, DestinationDir, Filter: string); 66 var 67 Src, Dst: TSearchRec; 68 begin 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); 79 end; 80 65 81 procedure UnitInit; 66 82 var 67 83 AppDataDir: string; 68 src, dst: TSearchRec;69 84 begin 70 85 LocaleCode := ''; … … 79 94 DataDir := AppDataDir; 80 95 end; 81 if not DirectoryExists(GetSavedDir) then CreateDir(GetSavedDir);82 if not DirectoryExists(GetMapsDir) then CreateDir(GetMapsDir);83 96 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), '*.*'); 105 99 end; 106 100
Note:
See TracChangeset
for help on using the changeset viewer.