Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/duplicati/duplicati.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorverhoek <30193551+verhoek@users.noreply.github.com>2018-10-25 17:42:53 +0300
committerverhoek <30193551+verhoek@users.noreply.github.com>2018-10-25 17:42:53 +0300
commit7872018bbd573ec360d59302909e1478b82f7606 (patch)
tree51b2f253cad0782558ac7ae3f6181c1b28c130c8 /Duplicati/Library/Snapshots
parent2e0fb275eaa5e9fcc0aeb2e896f409635d1381d9 (diff)
Moved vss to SystemIOWindows. Added GetDirectories to ISystemIO.
Diffstat (limited to 'Duplicati/Library/Snapshots')
-rw-r--r--Duplicati/Library/Snapshots/ISystemIO.cs1
-rw-r--r--Duplicati/Library/Snapshots/SystemIOLinux.cs12
-rw-r--r--Duplicati/Library/Snapshots/SystemIOWindows.cs23
-rw-r--r--Duplicati/Library/Snapshots/WindowsSnapshot.cs35
4 files changed, 45 insertions, 26 deletions
diff --git a/Duplicati/Library/Snapshots/ISystemIO.cs b/Duplicati/Library/Snapshots/ISystemIO.cs
index 0335bd908..1dff9e991 100644
--- a/Duplicati/Library/Snapshots/ISystemIO.cs
+++ b/Duplicati/Library/Snapshots/ISystemIO.cs
@@ -57,6 +57,7 @@ namespace Duplicati.Library.Snapshots
string PathChangeExtension(string path, string extension);
string PathCombine(string path1, string path2);
string GetPathRoot(string path);
+ string[] GetDirectories(string path);
IEnumerable<string> EnumerateFileSystemEntries(string path);
void SetMetadata(string path, Dictionary<string, string> metdata, bool restorePermissions);
diff --git a/Duplicati/Library/Snapshots/SystemIOLinux.cs b/Duplicati/Library/Snapshots/SystemIOLinux.cs
index e97dad02e..d4d7f2d87 100644
--- a/Duplicati/Library/Snapshots/SystemIOLinux.cs
+++ b/Duplicati/Library/Snapshots/SystemIOLinux.cs
@@ -246,7 +246,17 @@ namespace Duplicati.Library.Snapshots
// This should not be required, but some versions of Mono apperently do not strip the trailing slash
return p.Length > 1 && p[p.Length - 1] == Path.DirectorySeparatorChar ? p.Substring(0, p.Length - 1) : p;
- }
+ }
+
+ public string GetPathRoot(string path)
+ {
+ return Path.GetPathRoot(path);
+ }
+
+ public string[] GetDirectories(string path)
+ {
+ return Directory.GetDirectories(path);
+ }
}
}
diff --git a/Duplicati/Library/Snapshots/SystemIOWindows.cs b/Duplicati/Library/Snapshots/SystemIOWindows.cs
index 51bd88e75..07f2cd4c1 100644
--- a/Duplicati/Library/Snapshots/SystemIOWindows.cs
+++ b/Duplicati/Library/Snapshots/SystemIOWindows.cs
@@ -16,11 +16,11 @@
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
using System;
-using System.Linq;
using System.Collections.Generic;
using System.Security.AccessControl;
using System.IO;
+using Alphaleonis.Win32.Vss;
using AlphaFS = Alphaleonis.Win32.Filesystem;
@@ -615,6 +615,27 @@ namespace Duplicati.Library.Snapshots
public string GetPathRoot(string path)
{
return AlphaFS.Path.GetPathRoot(path);
+ }
+
+ public string[] GetDirectories(string path)
+ {
+ return AlphaFS.Directory.GetDirectories(path);
+ }
+
+ public static IVssBackupComponents CreateVssBackupComponents()
+ {
+ // Substitute for calling VssUtils.LoadImplementation(), as we have the dlls outside the GAC
+ var assemblyLocation = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
+ if (assemblyLocation == null)
+ throw new InvalidOperationException();
+
+ var alphadir = Path.Combine(assemblyLocation, "alphavss");
+ var alphadll = Path.Combine(alphadir, VssUtils.GetPlatformSpecificAssemblyShortName() + ".dll");
+ var vss = (IVssImplementation)System.Reflection.Assembly.LoadFile(alphadll).CreateInstance("Alphaleonis.Win32.Vss.VssImplementation");
+ if (vss == null)
+ throw new InvalidOperationException();
+
+ return vss.CreateVssBackupComponents();
}
#endregion
diff --git a/Duplicati/Library/Snapshots/WindowsSnapshot.cs b/Duplicati/Library/Snapshots/WindowsSnapshot.cs
index 81254c0bb..c8b55f0ec 100644
--- a/Duplicati/Library/Snapshots/WindowsSnapshot.cs
+++ b/Duplicati/Library/Snapshots/WindowsSnapshot.cs
@@ -16,13 +16,13 @@
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
//
-using System.Linq;
-
-
#endregion
+
using System;
using System.Collections.Generic;
using System.IO;
+using System.Linq;
+
using Alphaleonis.Win32.Vss;
using AlphaFS = Alphaleonis.Win32.Filesystem;
@@ -89,16 +89,11 @@ namespace Duplicati.Library.Snapshots
{
try
{
- // Substitute for calling VssUtils.LoadImplementation(), as we have the dlls outside the GAC
- var assemblyLocation = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
- if (assemblyLocation == null)
- throw new InvalidOperationException();
-
- var alphadir = Path.Combine(assemblyLocation, "alphavss");
- var alphadll = Path.Combine(alphadir, VssUtils.GetPlatformSpecificAssemblyShortName() + ".dll");
- var vss = (IVssImplementation)System.Reflection.Assembly.LoadFile(alphadll).CreateInstance("Alphaleonis.Win32.Vss.VssImplementation");
- if (vss == null)
- throw new InvalidOperationException();
+ //Prepare the backup
+ m_backup = SystemIOWindows.CreateVssBackupComponents();
+ m_backup.InitializeForBackup(null);
+ m_backup.SetContext(VssSnapshotContext.Backup);
+ m_backup.SetBackupState(false, true, VssBackupType.Full, false);
// Default to exclude the System State writer
var excludedWriters = new Guid[] { new Guid("{e8132975-6f93-4464-a53e-1050253ae220}") };
@@ -111,15 +106,6 @@ namespace Duplicati.Library.Snapshots
.ToArray();
}
- //Check if we should map any drives
- var useSubst = Utility.Utility.ParseBoolOption(options, "vss-use-mapping");
-
- //Prepare the backup
- m_backup = vss.CreateVssBackupComponents();
- m_backup.InitializeForBackup(null);
- m_backup.SetContext(VssSnapshotContext.Backup);
- m_backup.SetBackupState(false, true, VssBackupType.Full, false);
-
if (excludedWriters.Length > 0)
m_backup.DisableWriterClasses(excludedWriters.ToArray());
@@ -164,8 +150,9 @@ namespace Duplicati.Library.Snapshots
m_volumeReverseMap = m_volumeMap.ToDictionary(x => x.Value, x => x.Key);
+
//If we should map the drives, we do that now and update the volumeMap
- if (useSubst)
+ if (Utility.Utility.ParseBoolOption(options, "vss-use-mapping"))
{
m_mappedDrives = new List<DefineDosDevice>();
foreach (var k in new List<string>(m_volumeMap.Keys))
@@ -209,7 +196,7 @@ namespace Duplicati.Library.Snapshots
/// <returns>A list of non-shadow paths</returns>
protected override string[] ListFolders(string localFolderPath)
{
- var root = Utility.Utility.AppendDirSeparator(AlphaFS.Path.GetPathRoot(localFolderPath));
+ var root = Utility.Utility.AppendDirSeparator(IO_WIN.GetPathRoot(localFolderPath));
var volumePath = Utility.Utility.AppendDirSeparator(ConvertToSnapshotPath(root));
string[] tmp = null;