Skip to content

Commit

Permalink
Fixes #58
Browse files Browse the repository at this point in the history
Thanks Eduardo for finding this huge bug!
Now these USMT manifest files will actually work...
  • Loading branch information
krisdb2009 committed Jun 5, 2021
1 parent cb80857 commit 6709aff
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 16 deletions.
22 changes: 7 additions & 15 deletions SuperGrate/Classes/FileOperations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,26 +42,18 @@ public static bool CopyFolder(string Source, string Destination)
{
DirectoryInfo source = new DirectoryInfo(Source);
FileInfo[] sourceFiles = source.GetFiles("*", SearchOption.AllDirectories);
string lastStrippedPath = null;
Logger.UpdateProgress(0);
int progress = 0;
foreach (FileInfo file in sourceFiles)
{
if (USMT.Canceled) break;
string strippedFullPath = file.FullName.Replace(source.FullName, "").Replace(@"\", "");
string strippedPath = strippedFullPath.Replace(file.Name, "");
if (strippedPath != lastStrippedPath)
{
string targetDirectory = Path.Combine(Destination, strippedPath);
if (!Directory.Exists(targetDirectory))
{
Directory.CreateDirectory(targetDirectory);
}
lastStrippedPath = strippedPath;
}
string DestinationPath = Path.Combine(Destination, strippedFullPath);
Logger.Verbose(file.FullName + " => " + DestinationPath);
file.CopyTo(DestinationPath, true);
string strippedFullPath = file.FullName.Replace(source.FullName, "");
string destinationFullPath = Destination + strippedFullPath;
string relativeDirectoryPath = file.DirectoryName.Replace(source.FullName, "");
string destinationDirectoryPath = Destination + relativeDirectoryPath;
if (!Directory.Exists(destinationDirectoryPath)) Directory.CreateDirectory(destinationDirectoryPath);
file.CopyTo(destinationFullPath, true);
Logger.Verbose(file.FullName + " => " + destinationFullPath);
Logger.UpdateProgress(progress++, sourceFiles.Length);
}
return !USMT.Canceled;
Expand Down
2 changes: 1 addition & 1 deletion SuperGrate/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@

[assembly: Guid("2f05c2fb-1f11-4d53-9d9d-c8cec72ab64e")]

[assembly: AssemblyVersion("1.3.1.0")]
[assembly: AssemblyVersion("1.3.2.0")]

0 comments on commit 6709aff

Please sign in to comment.