From 1639bfdb506644cd312ae296bc435e399d7bd796 Mon Sep 17 00:00:00 2001 From: Niko Ehrenfeuchter <nikolaus.ehrenfeuchter@unibas.ch> Date: Wed, 31 Jan 2018 00:52:19 +0100 Subject: [PATCH] Enter commit message --- ATXCommon/FsUtils.cs | 15 +++++++++++++++ AutoTx/AutoTx.cs | 15 +-------------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/ATXCommon/FsUtils.cs b/ATXCommon/FsUtils.cs index 710d41e..9a816ef 100644 --- a/ATXCommon/FsUtils.cs +++ b/ATXCommon/FsUtils.cs @@ -185,5 +185,20 @@ namespace ATXCommon Log.Error("Error collecting orphaned files: {0}\n{1}", ex.Message, ex.StackTrace); } } + + /// <summary> + /// Ensure the required spooling directories (managed/incoming) exist. + /// </summary> + /// <param name="incoming">The path to the incoming location.</param> + /// <param name="managed">The path to the managed location.</param> + /// <returns>True if all dirs exist or were created successfully.</returns> + public static bool CheckSpoolingDirectories(string incoming, string managed) { + var retval = CheckForDirectory(incoming); + retval &= CheckForDirectory(managed); + retval &= CheckForDirectory(Path.Combine(managed, "PROCESSING")); + retval &= CheckForDirectory(Path.Combine(managed, "DONE")); + retval &= CheckForDirectory(Path.Combine(managed, "UNMATCHED")); + return retval; + } } } diff --git a/AutoTx/AutoTx.cs b/AutoTx/AutoTx.cs index d1ee6c5..9286b11 100644 --- a/AutoTx/AutoTx.cs +++ b/AutoTx/AutoTx.cs @@ -255,7 +255,7 @@ namespace AutoTx SetupMailLogging(); var configInvalid = false; - if (CheckSpoolingDirectories() == false) { + if (FsUtils.CheckSpoolingDirectories(_incomingPath, _managedPath) == false) { Log.Error("ERROR checking spooling directories (incoming / managed)!"); configInvalid = true; } @@ -785,19 +785,6 @@ namespace AutoTx return true; } - /// <summary> - /// Ensure the required spooling directories (managed/incoming) exist. - /// </summary> - /// <returns>True if all dirs exist or were created successfully.</returns> - private bool CheckSpoolingDirectories() { - var retval = FsUtils.CheckForDirectory(_incomingPath); - retval &= FsUtils.CheckForDirectory(_managedPath); - retval &= FsUtils.CheckForDirectory(Path.Combine(_managedPath, "PROCESSING")); - retval &= FsUtils.CheckForDirectory(Path.Combine(_managedPath, "DONE")); - retval &= FsUtils.CheckForDirectory(Path.Combine(_managedPath, "UNMATCHED")); - return retval; - } - /// <summary> /// Helper to create directories for all users that have one in the local /// user directory (C:\Users) AND in the DestinationDirectory. -- GitLab