diff --git a/Duplicati/Library/Common/Duplicati.Library.Common.csproj b/Duplicati/Library/Common/Duplicati.Library.Common.csproj index 31d3992e6..c3e7d30fa 100644 --- a/Duplicati/Library/Common/Duplicati.Library.Common.csproj +++ b/Duplicati/Library/Common/Duplicati.Library.Common.csproj @@ -13,5 +13,6 @@ + \ No newline at end of file diff --git a/thirdparty/UnixSupport/File.cs b/Duplicati/Library/Common/IO/PosixFile.cs similarity index 96% rename from thirdparty/UnixSupport/File.cs rename to Duplicati/Library/Common/IO/PosixFile.cs index 6b96081a6..d3f746adb 100644 --- a/thirdparty/UnixSupport/File.cs +++ b/Duplicati/Library/Common/IO/PosixFile.cs @@ -22,14 +22,14 @@ using System; using System.Collections.Generic; using Mono.Unix.Native; -namespace UnixSupport +namespace Duplicati.Library.Common.IO { - public static class File + public static class PosixFile { private static readonly bool SUPPORTS_LLISTXATTR; - static File () + static PosixFile () { bool works = false; try diff --git a/Duplicati/Library/Common/IO/SystemIOLinux.cs b/Duplicati/Library/Common/IO/SystemIOLinux.cs index d23fa5f59..570e9d036 100644 --- a/Duplicati/Library/Common/IO/SystemIOLinux.cs +++ b/Duplicati/Library/Common/IO/SystemIOLinux.cs @@ -108,12 +108,12 @@ namespace Duplicati.Library.Common.IO public void CreateSymlink(string symlinkfile, string target, bool asDir) { - UnixSupport.File.CreateSymlink(symlinkfile, target); + PosixFile.CreateSymlink(symlinkfile, target); } public string GetSymlinkTarget(string path) { - return UnixSupport.File.GetSymlinkTarget(NormalizePath(path)); + return PosixFile.GetSymlinkTarget(NormalizePath(path)); } public string PathGetDirectoryName(string path) @@ -181,12 +181,12 @@ namespace Duplicati.Library.Common.IO var f = NormalizePath(file); var dict = new Dictionary(); - var n = UnixSupport.File.GetExtendedAttributes(f, isSymlink, followSymlink); + var n = PosixFile.GetExtendedAttributes(f, isSymlink, followSymlink); if (n != null) foreach(var x in n) dict["unix-ext:" + x.Key] = Convert.ToBase64String(x.Value); - var fse = UnixSupport.File.GetUserGroupAndPermissions(f); + var fse = PosixFile.GetUserGroupAndPermissions(f); dict["unix:uid-gid-perm"] = string.Format("{0}-{1}-{2}", fse.UID, fse.GID, fse.Permissions); if (fse.OwnerName != null) { @@ -208,7 +208,7 @@ namespace Duplicati.Library.Common.IO var f = NormalizePath(file); foreach(var x in data.Where(x => x.Key.StartsWith("unix-ext:", StringComparison.Ordinal)).Select(x => new KeyValuePair(x.Key.Substring("unix-ext:".Length), Convert.FromBase64String(x.Value)))) - UnixSupport.File.SetExtendedAttribute(f, x.Key, x.Value); + PosixFile.SetExtendedAttribute(f, x.Key, x.Value); if (restorePermissions && data.ContainsKey("unix:uid-gid-perm")) { @@ -222,14 +222,14 @@ namespace Duplicati.Library.Common.IO if (long.TryParse(parts[0], out uid) && long.TryParse(parts[1], out gid) && long.TryParse(parts[2], out perm)) { if (data.ContainsKey("unix:owner-name")) - try { uid = UnixSupport.File.GetUserID(data["unix:owner-name"]); } + try { uid = PosixFile.GetUserID(data["unix:owner-name"]); } catch { } if (data.ContainsKey("unix:group-name")) - try { gid = UnixSupport.File.GetGroupID(data["unix:group-name"]); } + try { gid = PosixFile.GetGroupID(data["unix:group-name"]); } catch { } - UnixSupport.File.SetUserGroupAndPermissions(f, uid, gid, perm); + PosixFile.SetUserGroupAndPermissions(f, uid, gid, perm); } } } diff --git a/Duplicati/Library/Common/IO/SystemIOWindows.cs b/Duplicati/Library/Common/IO/SystemIOWindows.cs index c128703fa..981596882 100644 --- a/Duplicati/Library/Common/IO/SystemIOWindows.cs +++ b/Duplicati/Library/Common/IO/SystemIOWindows.cs @@ -237,22 +237,22 @@ namespace Duplicati.Library.Common.IO private System.Security.AccessControl.FileSystemSecurity GetAccessControlDir(string path) { - return System.IO.Directory.GetAccessControl(AddExtendedDevicePathPrefix(path)); + return new DirectoryInfo(AddExtendedDevicePathPrefix(path)).GetAccessControl(); } private System.Security.AccessControl.FileSystemSecurity GetAccessControlFile(string path) { - return System.IO.File.GetAccessControl(AddExtendedDevicePathPrefix(path)); + return new FileInfo(AddExtendedDevicePathPrefix(path)).GetAccessControl(); } private void SetAccessControlFile(string path, FileSecurity rules) { - System.IO.File.SetAccessControl(AddExtendedDevicePathPrefix(path), rules); + new FileInfo(AddExtendedDevicePathPrefix(path)).SetAccessControl(rules); } private void SetAccessControlDir(string path, DirectorySecurity rules) { - System.IO.Directory.SetAccessControl(AddExtendedDevicePathPrefix(path), rules); + new DirectoryInfo(AddExtendedDevicePathPrefix(path)).SetAccessControl(rules); } #region ISystemIO implementation diff --git a/Duplicati/Library/Common/IO/VssBackupComponents.cs b/Duplicati/Library/Common/IO/VssBackupComponents.cs index c99797a7b..fad050fe5 100644 --- a/Duplicati/Library/Common/IO/VssBackupComponents.cs +++ b/Duplicati/Library/Common/IO/VssBackupComponents.cs @@ -299,14 +299,7 @@ namespace Duplicati.Library.Common.IO 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(); - - //Here we don't need a custom Path.Combine: we need unconditional access to alphaFS - var alphadll = Path.Combine(assemblyLocation, "alphavss", VssUtils.GetPlatformSpecificAssemblyShortName() + ".dll"); - var vss = (IVssImplementation)System.Reflection.Assembly.LoadFile(alphadll).CreateInstance("Alphaleonis.Win32.Vss.VssImplementation"); + var vss = VssFactoryProvider.Default.GetVssFactory(); if (vss == null) throw new InvalidOperationException(); diff --git a/thirdparty/UnixSupport/README.txt b/thirdparty/UnixSupport/README.txt deleted file mode 100644 index b9345d996..000000000 --- a/thirdparty/UnixSupport/README.txt +++ /dev/null @@ -1,3 +0,0 @@ -This project is not really 3rd party. - -It was created solely for use with Duplicati, but it depends on the Mono.Posix.dll file, which is not found on the common Windows developer platform. By creating this mini project, it is possible to reference the functions from Mono.Posix during a Windows build without having access to the Mono.Posix.dll. As this dll is never invoked on Windows, it should have no interest to the Windows developer. diff --git a/thirdparty/UnixSupport/UnixSupport.csproj b/thirdparty/UnixSupport/UnixSupport.csproj deleted file mode 100644 index 409ad0f08..000000000 --- a/thirdparty/UnixSupport/UnixSupport.csproj +++ /dev/null @@ -1,14 +0,0 @@ - - - net8.0 - Library - 1.0 - - - - - - - - - \ No newline at end of file diff --git a/thirdparty/UnixSupport/UnixSupport.dll b/thirdparty/UnixSupport/UnixSupport.dll deleted file mode 100644 index 3d04df69f..000000000 Binary files a/thirdparty/UnixSupport/UnixSupport.dll and /dev/null differ