From 9b82a505e4e6a72f1fe837b63044732d635e2fd2 Mon Sep 17 00:00:00 2001 From: Niko Ehrenfeuchter <nikolaus.ehrenfeuchter@unibas.ch> Date: Fri, 15 Dec 2017 17:39:01 +0100 Subject: [PATCH] Handle empty folders inside the processing location. --- AutoTx/AutoTx.cs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/AutoTx/AutoTx.cs b/AutoTx/AutoTx.cs index fe4c5b5..c166bc6 100644 --- a/AutoTx/AutoTx.cs +++ b/AutoTx/AutoTx.cs @@ -619,9 +619,22 @@ namespace AutoTx var queued = new DirectoryInfo(processingDir).GetDirectories(); if (queued.Length == 0) return; - + + var subdirs = queued[0].GetDirectories(); + if (subdirs.Length == 0) { + writeLog("WARNING: empty processing directory found: " + queued[0].Name); + try { + queued[0].Delete(); + writeLogDebug("Removed empty directory: " + queued[0].Name); + } + catch (Exception ex) { + writeLog("Error deleting directory: " + queued[0].Name + " - " + ex.Message); + return; + } + return; + } try { - _status.CurrentTransferSrc = queued[0].GetDirectories()[0].FullName; + _status.CurrentTransferSrc = subdirs[0].FullName; _status.CurrentTransferSize = GetDirectorySize(_status.CurrentTransferSrc); } catch (Exception ex) { -- GitLab