Restore files from save archive based on entries in manifest

save-path-regex
Pat Hartl 2023-11-30 18:37:23 -06:00
parent 7b625b2f60
commit 82779bcc72
1 changed files with 30 additions and 28 deletions

View File

@ -67,13 +67,14 @@ namespace LANCommander.SDK
bool inInstallDir = savePath.Path.StartsWith("{InstallDir}");
string tempSavePath = Path.Combine(tempLocation, savePath.Id.ToString());
var tempSavePathFile = Path.Combine(tempSavePath, savePath.Path.Replace('/', Path.DirectorySeparatorChar).Replace("{InstallDir}" + Path.DirectorySeparatorChar, ""));
foreach (var entry in savePath.Entries)
{
var tempSavePathFile = Path.Combine(tempSavePath, entry.ArchivePath);
destination = Environment.ExpandEnvironmentVariables(savePath.Path.Replace('/', Path.DirectorySeparatorChar).Replace("{InstallDir}", installDirectory));
destination = Environment.ExpandEnvironmentVariables(entry.ActualPath).Replace("{InstallDir}", installDirectory);
if (File.Exists(tempSavePathFile))
{
// Is file, move file
if (File.Exists(destination))
File.Delete(destination);
@ -108,6 +109,7 @@ namespace LANCommander.SDK
}
}
}
}
#endregion
#region Handle registry importing