[DATFromDir, SimpleSort] Better temp folders

This commit is contained in:
Matt Nadareski
2016-09-16 16:21:11 -07:00
parent 4959c67bbb
commit c6c1c3de74
2 changed files with 4 additions and 4 deletions

View File

@@ -66,7 +66,7 @@ namespace SabreTools
_enableGzip = enableGzip; _enableGzip = enableGzip;
_addBlanks = addBlanks; _addBlanks = addBlanks;
_addDate = addDate; _addDate = addDate;
_tempDir = (String.IsNullOrEmpty(tempDir) ? Path.Combine(Environment.CurrentDirectory, "__tempdir__") : tempDir); _tempDir = (String.IsNullOrEmpty(tempDir) ? Path.Combine(Path.GetTempPath(), "__temp__") : tempDir);
_maxDegreeOfParallelism = maxDegreeOfParallelism; _maxDegreeOfParallelism = maxDegreeOfParallelism;
_logger = logger; _logger = logger;
} }
@@ -199,7 +199,7 @@ namespace SabreTools
private void ProcessPossibleArchive(string item) private void ProcessPossibleArchive(string item)
{ {
// Define the temporary directory // Define the temporary directory
string tempSubDir = Path.GetFullPath(Path.Combine(_tempDir, Path.GetFileNameWithoutExtension(item))) + Path.DirectorySeparatorChar; string tempSubDir = Path.GetFullPath(Path.Combine(_tempDir, Path.GetRandomFileName())) + 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)

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 == "" ? Path.Combine(Path.GetTempPath(), "__temp__") : tempdir);
_quickScan = quickScan; _quickScan = quickScan;
_toFolder = toFolder; _toFolder = toFolder;
_verify = verify; _verify = verify;
@@ -135,7 +135,7 @@ namespace SabreTools.Helper
foreach (string input in _inputs) foreach (string input in _inputs)
{ {
DATFromDir dfd = new DATFromDir(input, _datdata, false /* noMD5 */, false /* noSHA1 */, true /* bare */, false /* archivesAsFiles */, DATFromDir dfd = new DATFromDir(input, _datdata, false /* noMD5 */, false /* noSHA1 */, true /* bare */, false /* archivesAsFiles */,
true /* enableGzip */, false /* addBlanks */, false /* addDate */, "__temp__" /* tempdir */, 4 /* maxDegreeOfParallelism */, _logger); true /* enableGzip */, false /* addBlanks */, false /* addDate */, "" /* tempdir */, 4 /* maxDegreeOfParallelism */, _logger);
dfd.Start(); dfd.Start();
_datdata = dfd.DatData; _datdata = dfd.DatData;
} }