Fixed: Long path support on Windows

This commit is contained in:
Mark McDowall 2019-04-12 19:21:49 -07:00
parent 889f92268e
commit 0ca70a3197
4 changed files with 19 additions and 1 deletions

View File

@ -0,0 +1,15 @@
using System;
namespace NzbDrone.Common.Disk
{
public static class LongPathSupport
{
public static void Enable()
{
// Mono has an issue with enabling long path support via app.config.
// This works for both mono and .net on Windows.
AppContext.SetSwitch("Switch.System.IO.UseLegacyPathHandling", false);
AppContext.SetSwitch("Switch.System.IO.BlockLongPaths", false);
}
}
}

View File

@ -92,6 +92,7 @@
<Compile Include="Disk\FileSystemLookupService.cs" />
<Compile Include="Disk\DriveInfoMount.cs" />
<Compile Include="Disk\IMount.cs" />
<Compile Include="Disk\LongPathSupport.cs" />
<Compile Include="Disk\MountOptions.cs" />
<Compile Include="Disk\RelativeFileSystemModel.cs" />
<Compile Include="Disk\FileSystemModel.cs" />

View File

@ -3,6 +3,7 @@ using System.Reflection;
using System.Threading;
using NLog;
using NzbDrone.Common.Composition;
using NzbDrone.Common.Disk;
using NzbDrone.Common.EnvironmentInfo;
using NzbDrone.Common.Exceptions;
using NzbDrone.Common.Instrumentation;
@ -28,6 +29,8 @@ namespace NzbDrone.Host
throw new TerminateApplicationException("Missing system requirements");
}
LongPathSupport.Enable();
_container = MainAppContainerBuilder.BuildContainer(startupContext);
_container.Resolve<IAppFolderFactory>().Register();
_container.Resolve<IProvidePidFile>().Write();

View File

@ -10,7 +10,6 @@
</startup>
<runtime>
<loadFromRemoteSources enabled="true" />
<AppContextSwitchOverrides value="System.IO.UseLegacyPathHandling=false;System.IO.BlockLongPaths=false" />
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="libs" />
<dependentAssembly>