1
0
Fork 0
mirror of https://github.com/Sonarr/Sonarr synced 2024-12-24 08:44:46 +00:00

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\FileSystemLookupService.cs" />
<Compile Include="Disk\DriveInfoMount.cs" /> <Compile Include="Disk\DriveInfoMount.cs" />
<Compile Include="Disk\IMount.cs" /> <Compile Include="Disk\IMount.cs" />
<Compile Include="Disk\LongPathSupport.cs" />
<Compile Include="Disk\MountOptions.cs" /> <Compile Include="Disk\MountOptions.cs" />
<Compile Include="Disk\RelativeFileSystemModel.cs" /> <Compile Include="Disk\RelativeFileSystemModel.cs" />
<Compile Include="Disk\FileSystemModel.cs" /> <Compile Include="Disk\FileSystemModel.cs" />

View file

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

View file

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