diff options
author | Kenneth Skovhede <kenneth@hexad.dk> | 2018-06-30 20:14:36 +0300 |
---|---|---|
committer | Kenneth Skovhede <kenneth@hexad.dk> | 2018-06-30 20:14:36 +0300 |
commit | becf9f730733f42a768493621a75961c14e70139 (patch) | |
tree | 35d989d2282bfa1e9f3365753aaf09ce527c8a60 | |
parent | eed758c4791fe34b34d9366a3471eaa93e27c3d9 (diff) | |
parent | 06d6352aca385fd0d1bfb3dfef6501dc2998478e (diff) |
Merge branch 'feature/fix-vss-on-drive'
-rw-r--r-- | Duplicati/CommandLine/Program.cs | 15 | ||||
-rw-r--r-- | Duplicati/Library/Main/Controller.cs | 1 | ||||
-rw-r--r-- | Duplicati/Library/Snapshots/WindowsSnapshot.cs | 47 | ||||
-rw-r--r-- | Installer/Windows/UpdateVersion/Properties/AssemblyInfo.cs | 4 |
4 files changed, 52 insertions, 15 deletions
diff --git a/Duplicati/CommandLine/Program.cs b/Duplicati/CommandLine/Program.cs index 5c3565fee..3890509d5 100644 --- a/Duplicati/CommandLine/Program.cs +++ b/Duplicati/CommandLine/Program.cs @@ -203,6 +203,21 @@ namespace Duplicati.CommandLine string command = cargs[0];
cargs.RemoveAt(0);
+ if (verboseErrors)
+ {
+ outwriter.WriteLine("Input command: {0}", command);
+ outwriter.WriteLine("Input arguments: ");
+ foreach (var a in cargs)
+ outwriter.WriteLine("\t{0}", a);
+ outwriter.WriteLine();
+
+ outwriter.WriteLine("Input options: ");
+ foreach (var n in options)
+ outwriter.WriteLine("{0}: {1}", n.Key, n.Value);
+ outwriter.WriteLine();
+ }
+
+
if (CommandMap.ContainsKey(command))
{
var autoupdate = Library.Utility.Utility.ParseBoolOption(options, "auto-update");
diff --git a/Duplicati/Library/Main/Controller.cs b/Duplicati/Library/Main/Controller.cs index cdc3ee0bd..0794710c4 100644 --- a/Duplicati/Library/Main/Controller.cs +++ b/Duplicati/Library/Main/Controller.cs @@ -867,6 +867,7 @@ namespace Duplicati.Library.Main string source;
try
{
+ // TODO: This expands "C:" to CWD, but not C:\
source = System.IO.Path.GetFullPath(expandedSource);
}
catch (Exception ex)
diff --git a/Duplicati/Library/Snapshots/WindowsSnapshot.cs b/Duplicati/Library/Snapshots/WindowsSnapshot.cs index 049361a4d..f466f69cf 100644 --- a/Duplicati/Library/Snapshots/WindowsSnapshot.cs +++ b/Duplicati/Library/Snapshots/WindowsSnapshot.cs @@ -76,6 +76,11 @@ namespace Duplicati.Library.Snapshots private static SystemIOWindows IO_WIN = new SystemIOWindows();
/// <summary>
+ /// Commonly used string element
+ /// </summary>
+ private static string SLASH = Path.DirectorySeparatorChar.ToString();
+
+ /// <summary>
/// Constructs a new backup snapshot, using all the required disks
/// </summary>
/// <param name="sources">Sources to determine which volumes to include in snapshot</param>
@@ -404,18 +409,34 @@ namespace Duplicati.Library.Snapshots throw new InvalidOperationException();
}
+ /// <summary>
+ /// Cache element to speed up returning the same paths
+ /// </summary>
+ private KeyValuePair<string, string> m_lastLookup;
+
/// <inheritdoc />
public override string ConvertToSnapshotPath(string localPath)
{
+ // Hot cache, we tend to call the same conversion multiple times
+ var m = m_lastLookup;
+ if (m.Key == localPath)
+ return m.Value;
+
if (!Path.IsPathRooted(localPath))
throw new InvalidOperationException();
var root = AlphaFS.Path.GetPathRoot(localPath);
-
if (!m_volumeMap.TryGetValue(root, out var volumePath))
throw new InvalidOperationException();
- return Path.Combine(volumePath, localPath.Substring(root.Length));
+ // Note: Do NOT use Path.Combine as it strips the UNC path prefix
+ var subPath = localPath.Replace(root, String.Empty);
+ if (!volumePath.EndsWith(SLASH, StringComparison.Ordinal) && !subPath.StartsWith(SLASH, StringComparison.Ordinal))
+ subPath = subPath.Insert(0, SLASH);
+
+ var mappedPath = subPath.Insert(0, volumePath);
+ m_lastLookup = new KeyValuePair<string, string>(localPath, mappedPath);
+ return mappedPath;
}
/// <inheritdoc />
@@ -455,13 +476,13 @@ namespace Duplicati.Library.Snapshots catch (Exception ex)
{
Logging.Log.WriteVerboseMessage(LOGTAG, "MappedDriveCleanupError", ex, "Failed during VSS mapped drive unmapping");
- } - - try - { - m_backup?.BackupComplete(); + }
+
+ try
+ {
+ m_backup?.BackupComplete();
}
- catch (Exception ex) + catch (Exception ex)
{
Logging.Log.WriteVerboseMessage(LOGTAG, "VSSTerminateError", ex, "Failed to signal VSS completion");
}
@@ -471,12 +492,12 @@ namespace Duplicati.Library.Snapshots if (m_backup != null)
{
foreach (var g in m_volumes.Values)
- { - try - { - m_backup.DeleteSnapshot(g, false); + {
+ try
+ {
+ m_backup.DeleteSnapshot(g, false);
}
- catch (Exception ex) + catch (Exception ex)
{
Logging.Log.WriteVerboseMessage(LOGTAG, "VSSSnapShotDeleteError", ex, "Failed to close VSS snapshot");
}
diff --git a/Installer/Windows/UpdateVersion/Properties/AssemblyInfo.cs b/Installer/Windows/UpdateVersion/Properties/AssemblyInfo.cs index fc0544c74..35a565c7a 100644 --- a/Installer/Windows/UpdateVersion/Properties/AssemblyInfo.cs +++ b/Installer/Windows/UpdateVersion/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -using System.Reflection; +using System.Reflection; using System.Runtime.CompilerServices; // Information about this assembly is defined by the following attributes. @@ -17,7 +17,7 @@ using System.Runtime.CompilerServices; // The form "{Major}.{Minor}.*" will automatically update the build and revision, // and "{Major}.{Minor}.{Build}.*" will update just the revision. -[assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("2.0.0.7")] // The following attributes are used to specify the signing key for the assembly, // if desired. See the Mono documentation for more information about signing. |