Skip to content
Snippets Groups Projects
Commit 7dc0494d authored by Niko Ehrenfeuchter's avatar Niko Ehrenfeuchter :keyboard:
Browse files

Check parameters that need to specify local fixed disks.

Refers to #18, #28
parent 2bef5457
No related branches found
No related tags found
No related merge requests found
......@@ -334,6 +334,13 @@ namespace ATxCommon.Serializables
return string.Empty;
}
string CheckLocalDrive(string value, string name) {
var driveType = new DriveInfo(value).DriveType;
if (driveType != DriveType.Fixed)
return $"{name} ({value}) must be a local fixed drive, not '{driveType}'!\n";
return string.Empty;
}
void SubOptimal(string name, string value, string msg) {
Log.Warn(">>> Sub-optimal setting detected: <{0}> [{1}] {2}", name, value, msg);
}
......@@ -364,10 +371,7 @@ namespace ATxCommon.Serializables
// SourceDrive
if (c.SourceDrive.Substring(1) != @":\")
errmsg += "SourceDrive must be of form [X:\\]\n!";
var driveType = new DriveInfo(c.SourceDrive).DriveType;
if (driveType != DriveType.Fixed)
errmsg += $"SourceDrive ({c.SourceDrive}) must be a local (fixed) drive, " +
$"OS reports '{driveType}'!\n";
errmsg += CheckLocalDrive(c.SourceDrive, nameof(c.SourceDrive));
// spooling directories: IncomingDirectory + ManagedDirectory
if (c.IncomingDirectory.StartsWith(@"\"))
......@@ -383,7 +387,12 @@ namespace ATxCommon.Serializables
var tmpTransferPath = Path.Combine(c.DestinationDirectory, c.TmpTransferDir);
if (!Directory.Exists(tmpTransferPath))
errmsg += $"can't find (or reach) temporary transfer dir: {tmpTransferPath}\n";
// DriveName
foreach (var driveToCheck in c.SpaceMonitoring) {
errmsg += CheckLocalDrive(driveToCheck.DriveName, nameof(driveToCheck.DriveName));
}
// NON-CRITICAL stuff is simply reported to the logs:
if (!c.DestinationDirectory.StartsWith(@"\\"))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment