fixes for AlphaFS long path
This commit is contained in:
@@ -1,103 +1,35 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{D63E53E4-A458-4C2F-914D-92F715F58ACF}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Duplicati.Library.IO</RootNamespace>
|
||||
<AssemblyName>Duplicati.Library.IO</AssemblyName>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AssemblyOriginatorKeyFile>Duplicati.snk</AssemblyOriginatorKeyFile>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<OldToolsVersion>3.5</OldToolsVersion>
|
||||
<UpgradeBackupLocation />
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile />
|
||||
<UseMSBuildEngine>false</UseMSBuildEngine>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<Version>2.0.0.7</Version>
|
||||
|
||||
<Copyright>LGPL, Copyright © Duplicati Team 2015</Copyright>
|
||||
<Product>Duplicati.Library.IO</Product>
|
||||
<Company>Duplicati Team</Company>
|
||||
<Authors>Duplicati Team</Authors>
|
||||
<Description>Library.IO</Description>
|
||||
<PackageId>Library.IO</PackageId>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
|
||||
<PackageReference Include="AlphaFS" Version="2.1.3" />
|
||||
<PackageReference Include="AlphaVSS" Version="1.4.0" />
|
||||
<PackageReference Include="System.IO.FileSystem.AccessControl" Version="4.5.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Interface\Duplicati.Library.Interface.csproj" />
|
||||
<ProjectReference Include="..\Logging\Duplicati.Library.Logging.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="UnixSupport">
|
||||
<HintPath>..\..\..\thirdparty\UnixSupport\UnixSupport.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Management" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Transactions" />
|
||||
<Reference Include="AlphaVSS.Common">
|
||||
<HintPath>..\..\..\packages\AlphaVSS.1.4.0\lib\net45\AlphaVSS.Common.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="AlphaFS">
|
||||
<HintPath>..\..\..\packages\AlphaFS.2.1.3\lib\net45\AlphaFS.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json">
|
||||
<HintPath>..\..\..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Platform\Platform.cs" />
|
||||
<Compile Include="IO\SystemIO.cs" />
|
||||
<Compile Include="IO\SystemIOLinux.cs" />
|
||||
<Compile Include="IO\SystemIOWindows.cs" />
|
||||
<Compile Include="IO\ISystemIO.cs" />
|
||||
<Compile Include="IO\FileEntry.cs" />
|
||||
<Compile Include="IO\VssBackupComponents.cs" />
|
||||
<Compile Include="IO\Util.cs" />
|
||||
<Compile Include="IO\DefineDosDevice.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
<None Include="Duplicati.snk" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
<ItemGroup />
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Logging\Duplicati.Library.Logging.csproj">
|
||||
<Project>{D10A5FC0-11B4-4E70-86AA-8AEA52BD9798}</Project>
|
||||
<Name>Duplicati.Library.Logging</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Interface\Duplicati.Library.Interface.csproj">
|
||||
<Project>{C5899F45-B0FF-483C-9D38-24A9FCAAB237}</Project>
|
||||
<Name>Duplicati.Library.Interface</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="IO\" />
|
||||
<Folder Include="Platform\" />
|
||||
</ItemGroup>
|
||||
|
||||
<Import Project="..\..\..\packages\AlphaVSS.1.4.0\build\net45\AlphaVSS.targets" Condition="Exists('..\..\..\packages\AlphaVSS.1.4.0\build\net45\AlphaVSS.targets')" />
|
||||
</Project>
|
||||
|
||||
</Project>
|
||||
@@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
|
||||
<HasSharedItems>true</HasSharedItems>
|
||||
<SharedGUID>{3A169A2D-EDB4-41FD-87E0-8B942643F674}</SharedGUID>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Configuration">
|
||||
<Import_RootNamespace>Duplicati.Library.IO</Import_RootNamespace>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
Binary file not shown.
@@ -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>(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<U, T>(Func<string, T> 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<string> EnumerateDirectories(string path)
|
||||
{
|
||||
}
|
||||
|
||||
public IEnumerable<string> 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)
|
||||
{
|
||||
|
||||
@@ -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("")]
|
||||
@@ -1,4 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup>
|
||||
</configuration>
|
||||
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="AlphaFS" version="2.1.3" targetFramework="net45" />
|
||||
<package id="AlphaVSS" version="1.4.0" targetFramework="net45" />
|
||||
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net45" />
|
||||
</packages>
|
||||
@@ -13,12 +13,10 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
|
||||
<PackageReference Include="AlphaFS" Version="2.1.3" />
|
||||
<PackageReference Include="AlphaVSS" Version="1.4.0" />
|
||||
<PackageReference Include="System.IO.FileSystem.AccessControl" Version="4.5.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Common\Duplicati.Library.Common.csproj" />
|
||||
<ProjectReference Include="..\Interface\Duplicati.Library.Interface.csproj" />
|
||||
<ProjectReference Include="..\Localization\Duplicati.Library.Localization.csproj" />
|
||||
<ProjectReference Include="..\Logging\Duplicati.Library.Logging.csproj" />
|
||||
@@ -26,12 +24,6 @@
|
||||
<ProjectReference Include="..\Utility\Duplicati.Library.Utility.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="UnixSupport">
|
||||
<HintPath>..\..\..\thirdparty\UnixSupport\UnixSupport.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="lvm-scripts\create-lvm-snapshot.sh">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
@@ -44,6 +36,4 @@
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<Import Project="..\..\..\packages\AlphaVSS.1.4.0\build\net45\AlphaVSS.targets" Condition="Exists('..\..\..\packages\AlphaVSS.1.4.0\build\net45\AlphaVSS.targets')" />
|
||||
|
||||
</Project>
|
||||
@@ -18,6 +18,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Common\Duplicati.Library.Common.csproj" />
|
||||
<ProjectReference Include="..\Interface\Duplicati.Library.Interface.csproj" />
|
||||
<ProjectReference Include="..\Localization\Duplicati.Library.Localization.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -358,5 +358,10 @@
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="VersionTag.txt" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Library\Common\Duplicati.Library.Common.csproj" />
|
||||
<ProjectReference Include="..\Library\Utility\Duplicati.Library.Utility.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user