diff --git a/src/NzbDrone.Common/Disk/LongPathSupport.cs b/src/NzbDrone.Common/Disk/LongPathSupport.cs new file mode 100644 index 000000000..916123f8d --- /dev/null +++ b/src/NzbDrone.Common/Disk/LongPathSupport.cs @@ -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); + } + } +} diff --git a/src/NzbDrone.Common/NzbDrone.Common.csproj b/src/NzbDrone.Common/NzbDrone.Common.csproj index 21388fb7f..7942d2188 100644 --- a/src/NzbDrone.Common/NzbDrone.Common.csproj +++ b/src/NzbDrone.Common/NzbDrone.Common.csproj @@ -106,6 +106,7 @@ + diff --git a/src/NzbDrone.Host/Bootstrap.cs b/src/NzbDrone.Host/Bootstrap.cs index 28a9be29b..a562f44e8 100644 --- a/src/NzbDrone.Host/Bootstrap.cs +++ b/src/NzbDrone.Host/Bootstrap.cs @@ -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; @@ -32,6 +33,8 @@ namespace NzbDrone.Host throw new TerminateApplicationException("Missing system requirements"); } + LongPathSupport.Enable(); + _container = MainAppContainerBuilder.BuildContainer(startupContext); _container.Resolve().Register(); _container.Resolve().Write(); diff --git a/src/NzbDrone.Host/app.config b/src/NzbDrone.Host/app.config index cdde64137..dfc9fa3f9 100644 --- a/src/NzbDrone.Host/app.config +++ b/src/NzbDrone.Host/app.config @@ -10,7 +10,6 @@ -