From df57d29c11499538619b0e3ac87d7c294f0b4cba Mon Sep 17 00:00:00 2001
From: Niko Ehrenfeuchter <nikolaus.ehrenfeuchter@unibas.ch>
Date: Fri, 15 Sep 2017 23:31:36 +0200
Subject: [PATCH] Check CurrentTransferSrc and CurrentTargetTmp for valid
 settings.

Refers to issue #7
---
 AutoTx/AutoTx.cs | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/AutoTx/AutoTx.cs b/AutoTx/AutoTx.cs
index ee469c5..8d9d80e 100644
--- a/AutoTx/AutoTx.cs
+++ b/AutoTx/AutoTx.cs
@@ -185,6 +185,22 @@ namespace AutoTx
                     configInvalid = true;
                 }
 
+                // CurrentTransferSrc
+                if (_status.CurrentTransferSrc.Length > 0
+                    && !Directory.Exists(_status.CurrentTransferSrc)) {
+                    writeLog("WARNING: status file contains non-existing source path of an " +
+                        "unfinished transfer: " + _status.CurrentTransferSrc);
+                    _status.CurrentTransferSrc = "";
+                }
+
+                // CurrentTargetTmp
+                if (_status.CurrentTargetTmp.Length > 0
+                    && !Directory.Exists(ExpandCurrentTargetTmp())) {
+                    writeLog("WARNING: status file contains non-existing temporary path of an " +
+                        "unfinished transfer: " + _status.CurrentTargetTmp);
+                    _status.CurrentTargetTmp = "";
+                }
+
                 // ServiceTimer
                 if (_config.ServiceTimer < 1000) {
                     writeLog("ERROR: ServiceTimer must not be smaller than 1000 ms!");
-- 
GitLab