[DATFromDir, SimpleSort] Make temp folders more standardized (better for parallel?)

This commit is contained in:
Matt Nadareski
2016-09-16 15:50:48 -07:00
parent 9581fa2054
commit 566e6a8f6f
2 changed files with 9 additions and 10 deletions

View File

@@ -66,7 +66,7 @@ namespace SabreTools
_enableGzip = enableGzip; _enableGzip = enableGzip;
_addBlanks = addBlanks; _addBlanks = addBlanks;
_addDate = addDate; _addDate = addDate;
_tempDir = tempDir; _tempDir = (String.IsNullOrEmpty(tempDir) ? Path.Combine(Environment.CurrentDirectory, "__tempdir__") : tempDir);
_maxDegreeOfParallelism = maxDegreeOfParallelism; _maxDegreeOfParallelism = maxDegreeOfParallelism;
_logger = logger; _logger = logger;
} }
@@ -199,8 +199,7 @@ namespace SabreTools
private void ProcessPossibleArchive(string item) private void ProcessPossibleArchive(string item)
{ {
// Define the temporary directory // Define the temporary directory
string tempSubDir = (String.IsNullOrEmpty(_tempDir) ? Environment.CurrentDirectory : _tempDir); string tempSubDir = Path.GetFullPath(Path.Combine(_tempDir, Path.GetFileNameWithoutExtension(item))) + Path.DirectorySeparatorChar;
tempSubDir = Path.GetFullPath(Path.Combine(tempSubDir, "__temp__", Path.GetFileNameWithoutExtension(item))) + 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 (_datdata.Romba) if (_datdata.Romba)
@@ -283,18 +282,18 @@ namespace SabreTools
: ""), : ""),
Path.GetFileNameWithoutExtension(item))); Path.GetFileNameWithoutExtension(item)));
}); });
// Clear the temp directory
if (Directory.Exists(tempSubDir))
{
FileTools.CleanDirectory(tempSubDir);
}
} }
// Otherwise, just get the info on the file itself // Otherwise, just get the info on the file itself
else if (File.Exists(item)) else if (File.Exists(item))
{ {
ProcessFile(item, _basePath, ""); ProcessFile(item, _basePath, "");
} }
// Delete the sub temp directory
if (Directory.Exists(tempSubDir))
{
Directory.Delete(tempSubDir, true);
}
} }
} }

View File

@@ -55,7 +55,7 @@ namespace SabreTools.Helper
_datdata = datdata; _datdata = datdata;
_inputs = inputs; _inputs = inputs;
_outdir = (outdir == "" ? "Rebuild" : outdir); _outdir = (outdir == "" ? "Rebuild" : outdir);
_tempdir = (tempdir == "" ? "__TEMP__" : tempdir); _tempdir = (tempdir == "" ? "__temp__" : tempdir);
_quickScan = quickScan; _quickScan = quickScan;
_toFolder = toFolder; _toFolder = toFolder;
_verify = verify; _verify = verify;