diff --git a/Duplicati/Library/Common/Duplicati.Library.Common.csproj b/Duplicati/Library/Common/Duplicati.Library.Common.csproj index be138ff58..4285617b7 100644 --- a/Duplicati/Library/Common/Duplicati.Library.Common.csproj +++ b/Duplicati/Library/Common/Duplicati.Library.Common.csproj @@ -1,103 +1,35 @@ - - + + - Debug - AnyCPU - {D63E53E4-A458-4C2F-914D-92F715F58ACF} - Library - Properties - Duplicati.Library.IO - Duplicati.Library.IO - 512 - Duplicati.snk - - - 3.5 - - v4.5 - - false - 8.0.30703 - 2.0 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - false + netstandard2.0 + 2.0.0.7 + + LGPL, Copyright © Duplicati Team 2015 + Duplicati.Library.IO + Duplicati Team + Duplicati Team + Library.IO + Library.IO + + + + + + + + + + + + + - ..\..\..\thirdparty\UnixSupport\UnixSupport.dll - - - - - - - ..\..\..\packages\AlphaVSS.1.4.0\lib\net45\AlphaVSS.Common.dll - - - ..\..\..\packages\AlphaFS.2.1.3\lib\net45\AlphaFS.dll - - - ..\..\..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll - - - - - - - - - - - - - - - - - - - - - - - - - {D10A5FC0-11B4-4E70-86AA-8AEA52BD9798} - Duplicati.Library.Logging - - - {C5899F45-B0FF-483C-9D38-24A9FCAAB237} - Duplicati.Library.Interface - - - - - + - + + \ No newline at end of file diff --git a/Duplicati/Library/Common/Duplicati.Library.IO.projitems b/Duplicati/Library/Common/Duplicati.Library.IO.projitems deleted file mode 100644 index cc5809a92..000000000 --- a/Duplicati/Library/Common/Duplicati.Library.IO.projitems +++ /dev/null @@ -1,11 +0,0 @@ - - - - $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - true - {3A169A2D-EDB4-41FD-87E0-8B942643F674} - - - Duplicati.Library.IO - - \ No newline at end of file diff --git a/Duplicati/Library/Common/Duplicati.snk b/Duplicati/Library/Common/Duplicati.snk deleted file mode 100644 index e0c1e2dd8..000000000 Binary files a/Duplicati/Library/Common/Duplicati.snk and /dev/null differ diff --git a/Duplicati/Library/Common/IO/SystemIOWindows.cs b/Duplicati/Library/Common/IO/SystemIOWindows.cs index 7949fcc55..538b8aa3d 100644 --- a/Duplicati/Library/Common/IO/SystemIOWindows.cs +++ b/Duplicati/Library/Common/IO/SystemIOWindows.cs @@ -35,7 +35,7 @@ namespace Duplicati.Library.Common.IO private static bool IsPathTooLong(string path) { - return path.StartsWith(UNCPREFIX, StringComparison.Ordinal) || path.StartsWith(UNCPREFIX_SERVER, StringComparison.Ordinal) || path.Length > 260; + return path.StartsWith(UNCPREFIX, StringComparison.Ordinal) || path.StartsWith(UNCPREFIX_SERVER, StringComparison.Ordinal) || path.Length > 260; } public static string PrefixWithUNC(string path) @@ -91,11 +91,11 @@ namespace Duplicati.Library.Common.IO } } - private static Newtonsoft.Json.JsonSerializer _cachedSerializer; - - private Newtonsoft.Json.JsonSerializer Serializer - { - get + private static Newtonsoft.Json.JsonSerializer _cachedSerializer; + + private Newtonsoft.Json.JsonSerializer Serializer + { + get { if (_cachedSerializer != null) { @@ -106,8 +106,8 @@ namespace Duplicati.Library.Common.IO new Newtonsoft.Json.JsonSerializerSettings { Culture = System.Globalization.CultureInfo.InvariantCulture }); return _cachedSerializer; - } - } + } + } private string SerializeObject(T o) { @@ -129,28 +129,68 @@ namespace Duplicati.Library.Common.IO private System.Security.AccessControl.FileSystemSecurity GetAccessControlDir(string path) { - return PathTooLongFuncWrapper(System.IO.Directory.GetAccessControl, - Alphaleonis.Win32.Filesystem.Directory.GetAccessControl, path, true); + if (!IsPathTooLong(path)) + try + { + var di = new DirectoryInfo(path); + return di.GetAccessControl(); + } + catch (System.IO.PathTooLongException) { } + catch (System.ArgumentException) { } + + //TODO-DNC Revert back to proper call when Library will be netstandard ready + return (System.Security.AccessControl.FileSystemSecurity) + typeof(Alphaleonis.Win32.Filesystem.Directory).GetMethod("GetAccessControl", new Type[] { typeof(string) }) + .Invoke(null, new object[] { PrefixWithUNC(path) }); } private System.Security.AccessControl.FileSystemSecurity GetAccessControlFile(string path) { - return PathTooLongFuncWrapper(System.IO.File.GetAccessControl, - Alphaleonis.Win32.Filesystem.File.GetAccessControl, path, true); + if (!IsPathTooLong(path)) + try + { + var fi = new FileInfo(path); + return fi.GetAccessControl(); + } + catch (System.IO.PathTooLongException) { } + catch (System.ArgumentException) { } + + //TODO-DNC Revert back to proper call when Library will be netstandard ready + return (System.Security.AccessControl.FileSystemSecurity) + typeof(Alphaleonis.Win32.Filesystem.File).GetMethod("GetAccessControl", new Type[] { typeof(string) }) + .Invoke(null, new object[] { PrefixWithUNC(path) }); } private void SetAccessControlFile(string path, FileSecurity rules) { - PathTooLongActionWrapper(p => System.IO.File.SetAccessControl(p, rules), - p => Alphaleonis.Win32.Filesystem.File.SetAccessControl(p, rules, AccessControlSections.All), - path, true); + if (!IsPathTooLong(path)) + try + { + new FileInfo(path).SetAccessControl(rules); + return; + } + catch (System.IO.PathTooLongException) { } + catch (System.ArgumentException) { } + + //TODO-DNC Revert back to proper call when Library will be netstandard ready + typeof(Alphaleonis.Win32.Filesystem.File).GetMethod("SetAccessControl", new Type[] { typeof(string), typeof(System.Security.AccessControl.FileSystemSecurity), typeof(AccessControlSections) }) + .Invoke(null, new object[] { PrefixWithUNC(path), rules, AccessControlSections.All }); } private void SetAccessControlDir(string path, DirectorySecurity rules) { - PathTooLongActionWrapper(p => System.IO.Directory.SetAccessControl(p, rules), - p => Alphaleonis.Win32.Filesystem.Directory.SetAccessControl(p, rules, AccessControlSections.All), - path, true); + if (!IsPathTooLong(path)) + try + { + new DirectoryInfo(path).SetAccessControl(rules); + return; + } + catch (System.IO.PathTooLongException) { } + catch (System.ArgumentException) { } + + //TODO-DNC Revert back to proper call when Library will be netstandard ready + typeof(Alphaleonis.Win32.Filesystem.Directory).GetMethod("SetAccessControl", new Type[] { typeof(string), typeof(System.Security.AccessControl.FileSystemSecurity), typeof(AccessControlSections) }) + .Invoke(null, new object[] { PrefixWithUNC(path), rules, AccessControlSections.All }); } private static void PathTooLongVoidFuncWrapper(Func nativeIOFunc, @@ -379,13 +419,13 @@ namespace Duplicati.Library.Common.IO p => Alphaleonis.Win32.Filesystem.Directory.Delete(p, recursive), path, true); } - - public string GetPathRoot(string path) + + public string GetPathRoot(string path) { - return PathTooLongFuncWrapper(Path.GetPathRoot, AlphaFS.Path.GetPathRoot, path, false); + return PathTooLongFuncWrapper(Path.GetPathRoot, AlphaFS.Path.GetPathRoot, path, false); } - public string[] GetDirectories(string path) + public string[] GetDirectories(string path) { return PathTooLongFuncWrapper(Directory.GetDirectories, AlphaFS.Directory.GetDirectories, path, false); } @@ -408,25 +448,25 @@ namespace Duplicati.Library.Common.IO public DateTime GetLastWriteTimeUtc(string path) { return PathTooLongFuncWrapper(Directory.GetLastWriteTimeUtc, AlphaFS.File.GetLastWriteTimeUtc, path, false); - } - - public IEnumerable EnumerateDirectories(string path) - { + } + + public IEnumerable EnumerateDirectories(string path) + { return PathTooLongFuncWrapper(Directory.EnumerateDirectories, AlphaFS.Directory.EnumerateDirectories, path, false); - } - - public void FileCopy(string source, string target, bool overwrite) - { + } + + public void FileCopy(string source, string target, bool overwrite) + { // We do not check if path is too long on target. If so, then we catch an exception. - PathTooLongActionWrapper(p => File.Copy(p, target, overwrite), p => AlphaFS.File.Copy(p, target, overwrite), source, false); - } - - public string PathGetFullPath(string path) - { + PathTooLongActionWrapper(p => File.Copy(p, target, overwrite), p => AlphaFS.File.Copy(p, target, overwrite), source, false); + } + + public string PathGetFullPath(string path) + { return PathTooLongFuncWrapper(System.IO.Path.GetFullPath, AlphaFS.Path.GetFullPath, path, false); - } - - public IFileEntry DirectoryEntry(string path) + } + + public IFileEntry DirectoryEntry(string path) { IFileEntry DirectoryEntryNative(string p) { var dInfo = new DirectoryInfo(p); @@ -446,9 +486,9 @@ namespace Duplicati.Library.Common.IO } return PathTooLongFuncWrapper(DirectoryEntryNative, DirectoryEntryAlphaFS, path, false); - } - - public IFileEntry FileEntry(string path) + } + + public IFileEntry FileEntry(string path) { IFileEntry FileEntryNative(string p) { diff --git a/Duplicati/Library/Common/Properties/AssemblyInfo.cs b/Duplicati/Library/Common/Properties/AssemblyInfo.cs deleted file mode 100644 index 4e6119be6..000000000 --- a/Duplicati/Library/Common/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (C) 2018, The Duplicati Team -// http://www.duplicati.com, info@duplicati.com -// -// This library is free software; you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as -// published by the Free Software Foundation; either version 2.1 of the -// License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// 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.Reflection; -using System.Runtime.CompilerServices; - -// Information about this assembly is defined by the following attributes. -// Change them to the values specific to your project. - -[assembly: AssemblyTitle("Duplicati.Library.IO")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("")] -[assembly: AssemblyCopyright("LGPL, Copyright © Duplicati Team 2018")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". -// The form "{Major}.{Minor}.*" will automatically update the build and revision, -// and "{Major}.{Minor}.{Build}.*" will update just the revision. - -[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. - -//[assembly: AssemblyDelaySign(false)] -//[assembly: AssemblyKeyFile("")] diff --git a/Duplicati/Library/Common/app.config b/Duplicati/Library/Common/app.config deleted file mode 100644 index 469464a22..000000000 --- a/Duplicati/Library/Common/app.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/Duplicati/Library/Common/packages.config b/Duplicati/Library/Common/packages.config deleted file mode 100644 index f58651f3a..000000000 --- a/Duplicati/Library/Common/packages.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/Duplicati/Library/Snapshots/Duplicati.Library.Snapshots.csproj b/Duplicati/Library/Snapshots/Duplicati.Library.Snapshots.csproj index fa24ccea6..c0fd75f41 100644 --- a/Duplicati/Library/Snapshots/Duplicati.Library.Snapshots.csproj +++ b/Duplicati/Library/Snapshots/Duplicati.Library.Snapshots.csproj @@ -13,12 +13,10 @@ - - - + @@ -26,12 +24,6 @@ - - - ..\..\..\thirdparty\UnixSupport\UnixSupport.dll - - - PreserveNewest @@ -44,6 +36,4 @@ - - \ No newline at end of file diff --git a/Duplicati/Library/Utility/Duplicati.Library.Utility.csproj b/Duplicati/Library/Utility/Duplicati.Library.Utility.csproj index 72615551b..2535bc527 100644 --- a/Duplicati/Library/Utility/Duplicati.Library.Utility.csproj +++ b/Duplicati/Library/Utility/Duplicati.Library.Utility.csproj @@ -18,6 +18,7 @@ + diff --git a/Duplicati/License/Duplicati.License.csproj b/Duplicati/License/Duplicati.License.csproj index 0a48cfb6a..754ef9f1a 100644 --- a/Duplicati/License/Duplicati.License.csproj +++ b/Duplicati/License/Duplicati.License.csproj @@ -358,5 +358,10 @@ + + + + + \ No newline at end of file