Changeset 178 for branches/highdpi/Packages/CevoComponents/Directories.pas
- Timestamp:
- Jun 23, 2019, 3:15:29 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/highdpi/Packages/CevoComponents/Directories.pas
r169 r178 4 4 5 5 var 6 HomeDir: string; 7 DataDir: string; 6 HomeDir, DataDir: string; 8 7 LocaleCode: string = ''; 9 8 LocaleCodeAuto: string = ''; … … 11 10 function LocalizedFilePath(const Path: string): string; 12 11 procedure InitUnit; 13 function GetSavedDir(Home: Boolean = False): string;14 function GetMapsDir(Home: Boolean = False): string;15 12 16 13 … … 72 69 else 73 70 begin 74 if not DirectoryExists(AppDataDir) then CreateDir(AppDataDir); 71 if not DirectoryExists(AppDataDir) then 72 CreateDir(AppDataDir); 75 73 DataDir := AppDataDir; 76 74 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'); 79 79 80 80 // Copy appdata if not done yet 81 if FindFirst( GetSavedDir(True)+ DirectorySeparator + '*.cevo', $21, src) = 0 then81 if FindFirst(HomeDir + 'Saved' + DirectorySeparator + '*.cevo', $21, src) = 0 then 82 82 repeat 83 if (FindFirst( GetSavedDir(True)+ DirectorySeparator + src.Name, $21, dst) <> 0) or83 if (FindFirst(DataDir + 'Saved' + DirectorySeparator + src.Name, $21, dst) <> 0) or 84 84 (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); 87 87 FindClose(dst); 88 88 until FindNext(src) <> 0; … … 90 90 91 91 // Copy appdata if not done yet 92 if FindFirst( GetMapsDir(True)+ DirectorySeparator + '*.*', $21, src) = 0 then92 if FindFirst(HomeDir + 'Maps' + DirectorySeparator + '*.*', $21, src) = 0 then 93 93 repeat 94 if (FindFirst( GetMapsDir(True)+ DirectorySeparator + src.Name, $21, dst) <> 0) or94 if (FindFirst(DataDir + 'Maps' + DirectorySeparator + src.Name, $21, dst) <> 0) or 95 95 (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); 98 98 FindClose(dst); 99 99 until FindNext(src) <> 0; … … 101 101 end; 102 102 103 function GetSavedDir(Home: Boolean = False): string;104 begin105 if Home then Result := HomeDir + 'Saved'106 else Result := DataDir + 'Saved';107 end;108 109 function GetMapsDir(Home: Boolean = False): string;110 begin111 if Home then Result := HomeDir + 'Maps'112 else Result := DataDir + 'Maps';113 end;114 115 103 end.
Note:
See TracChangeset
for help on using the changeset viewer.