From 652e02d64e6cc481f2fa224e025af2413e67d6c2 Mon Sep 17 00:00:00 2001 From: "kenneth.skovhede@gmail.com" Date: Sat, 22 Oct 2011 14:53:41 +0000 Subject: [PATCH] Fixed a bug with create-folders that was introduced with r913 (issue #251) git-svn-id: https://duplicati.googlecode.com/svn/trunk@940 59da171f-624f-0410-aa54-27559c288bec --- Duplicati/Library/Main/BackendWrapper.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Duplicati/Library/Main/BackendWrapper.cs b/Duplicati/Library/Main/BackendWrapper.cs index 97b1871ab..17ad240cb 100644 --- a/Duplicati/Library/Main/BackendWrapper.cs +++ b/Duplicati/Library/Main/BackendWrapper.cs @@ -45,6 +45,10 @@ namespace Duplicati.Library.Main /// used to prevent disposing the initally created backend /// private bool m_first_backend_use; + /// + /// A flag indicating if the backend can create folders + /// + private bool m_backendSupportsCreateFolder; /// /// The statistics gathering object @@ -201,6 +205,7 @@ namespace Duplicati.Library.Main m_reuse_backend = !m_options.NoConnectionReuse; m_first_backend_use = true; + m_backendSupportsCreateFolder = m_backend is Library.Interface.IBackend_v2; if (m_options.AutoCleanup) m_orphans = new List(); @@ -774,7 +779,7 @@ namespace Duplicati.Library.Main m_statistics.LogError(ex.Message, ex); DisposeBackend(); - if (ex is Library.Interface.FolderMissingException && m_backend is Library.Interface.IBackend_v2 && m_options.AutocreateFolders) + if (ex is Library.Interface.FolderMissingException && m_backendSupportsCreateFolder && m_options.AutocreateFolders) return new List(); retries--; @@ -1144,7 +1149,7 @@ namespace Duplicati.Library.Main //Even if we can create the folder, we still count it as an error to prevent trouble with backends // that report OK for CreateFolder, but still report the folder as missing - if (ex is Library.Interface.FolderMissingException && m_backend is Library.Interface.IBackend_v2 && m_options.AutocreateFolders) + if (ex is Library.Interface.FolderMissingException && m_backendSupportsCreateFolder && m_options.AutocreateFolders) { ResetBackend(); try @@ -1201,7 +1206,7 @@ namespace Duplicati.Library.Main public void CreateFolder() { - if (m_backend is Library.Interface.IBackend_v2) + if (m_backendSupportsCreateFolder) ProtectedInvoke("CreateFolderInternal"); else throw new Exception(string.Format(Strings.BackendWrapper.BackendDoesNotSupportCreateFolder, m_backend.DisplayName, m_backend.ProtocolKey));