Changeset 240


Ignore:
Timestamp:
May 18, 2020, 2:28:16 PM (4 years ago)
Author:
chronos
Message:
  • Fixed: Saved and predefined maps were not correctly copied from application directory to user home data directory.
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Install/win/Common.iss

    r234 r240  
    7373Source: "{#MyAppSubDir}\Sounds\*.*"; DestDir: "{app}\Sounds"; Flags: ignoreversion; Components: main
    7474Source: "{#MyAppSubDir}\Tribes\*.*"; DestDir: "{app}\Tribes"; Flags: ignoreversion; Components: main
     75Source: "{#MyAppSubDir}\Saved\*.*"; DestDir: "{app}\Saved"; Flags: ignoreversion; Components: main
     76Source: "{#MyAppSubDir}\Maps\*.*"; DestDir: "{app}\Maps"; Flags: ignoreversion; Components: maps
    7577Source: "{#MyAppSubDir}\Localization\cs\*.*"; DestDir: "{app}\Localization\cs"; Flags: ignoreversion recursesubdirs; Components: lang\cs
    7678Source: "{#MyAppSubDir}\Localization\de\*.*"; DestDir: "{app}\Localization\de"; Flags: ignoreversion recursesubdirs; Components: lang\de
     
    8688Source: "{#MyAppSubDir}\AI\StdAI\StdAI.png"; DestDir: "{app}\AI\StdAI"; Flags: ignoreversion; Components: ai\stdai
    8789Source: "{#MyAppSubDir}\AI\StdAI\StdAI.ai.txt"; DestDir: "{app}\AI\StdAI"; Flags: ignoreversion; Components: ai\stdai
    88 Source: "{#MyAppSubDir}\Maps\*.*"; DestDir: "{localappdata}\c-evo\Maps"; Flags: ignoreversion; Components: maps
    89 Source: "{#MyAppSubDir}\Saved\*.*"; DestDir: "{localappdata}\c-evo\Saved"; Flags: ignoreversion; Components: main
    9090; NOTE: Don't use "Flags: ignoreversion" on any shared system files
    9191
  • trunk/Packages/CevoComponents/Directories.pas

    r199 r240  
    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.