[DatFile] RandomFileName is not good enough

This commit is contained in:
Matt Nadareski
2017-12-05 15:10:04 -08:00
parent af0ab5a10e
commit 161a869e0f

View File

@@ -3344,7 +3344,7 @@ namespace SabreTools.Library.DatFiles
SkipFileType skipFileType, bool addBlanks, bool addDate, string tempDir, bool copyFiles, string headerToCheckAgainst, bool chdsAsFiles) SkipFileType skipFileType, bool addBlanks, bool addDate, string tempDir, bool copyFiles, string headerToCheckAgainst, bool chdsAsFiles)
{ {
// Define the temporary directory // Define the temporary directory
string tempSubDir = Path.GetFullPath(Path.Combine(tempDir, Path.GetRandomFileName())) + Path.DirectorySeparatorChar; string tempSubDir = Path.GetFullPath(Path.Combine(tempDir, new Guid().ToString())) + Path.DirectorySeparatorChar;
// Special case for if we are in Romba mode (all names are supposed to be SHA-1 hashes) // Special case for if we are in Romba mode (all names are supposed to be SHA-1 hashes)
if (Romba) if (Romba)
@@ -3373,7 +3373,7 @@ namespace SabreTools.Library.DatFiles
string newBasePath = basePath; string newBasePath = basePath;
if (copyFiles) if (copyFiles)
{ {
newBasePath = Path.Combine(tempDir, Path.GetRandomFileName()); newBasePath = Path.Combine(tempDir, new Guid().ToString());
newItem = Path.GetFullPath(Path.Combine(newBasePath, Path.GetFullPath(item).Remove(0, basePath.Length + 1))); newItem = Path.GetFullPath(Path.Combine(newBasePath, Path.GetFullPath(item).Remove(0, basePath.Length + 1)));
Directory.CreateDirectory(Path.GetDirectoryName(newItem)); Directory.CreateDirectory(Path.GetDirectoryName(newItem));
File.Copy(item, newItem, true); File.Copy(item, newItem, true);