diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2017-02-20 15:50:58 -0500 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2017-02-20 15:50:58 -0500 |
| commit | 5d55b36487b25b2efaf6923a3c069f4b0b59a449 (patch) | |
| tree | dacf7607a28bf65a67004f65fdb1f1e33f3c075f /MediaBrowser.ServerApplication/MainStartup.cs | |
| parent | de3ca87a763506badcf1518ae288a5736605445c (diff) | |
make more classes portable
Diffstat (limited to 'MediaBrowser.ServerApplication/MainStartup.cs')
| -rw-r--r-- | MediaBrowser.ServerApplication/MainStartup.cs | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/MediaBrowser.ServerApplication/MainStartup.cs b/MediaBrowser.ServerApplication/MainStartup.cs index c42cd0396..b41e7607c 100644 --- a/MediaBrowser.ServerApplication/MainStartup.cs +++ b/MediaBrowser.ServerApplication/MainStartup.cs @@ -23,11 +23,14 @@ using Emby.Common.Implementations.Logging; using Emby.Common.Implementations.Networking; using Emby.Common.Implementations.Security; using Emby.Server.Core; +using Emby.Server.Core.Logging; using Emby.Server.Implementations; using Emby.Server.Implementations.Browser; using Emby.Server.Implementations.IO; +using Emby.Server.Implementations.Logging; using ImageMagickSharp; using MediaBrowser.Common.Net; +using MediaBrowser.Model.IO; using MediaBrowser.Server.Startup.Common.IO; namespace MediaBrowser.ServerApplication @@ -47,6 +50,8 @@ namespace MediaBrowser.ServerApplication public static string ApplicationPath; + private static IFileSystem FileSystem; + public static bool TryGetLocalFromUncDirectory(string local, out string unc) { if ((local == null) || (local == "")) @@ -259,16 +264,18 @@ namespace MediaBrowser.ServerApplication var resourcesPath = Path.GetDirectoryName(applicationPath); + Action<string> createDirectoryFn = s => Directory.CreateDirectory(s); + if (runAsService) { var systemPath = Path.GetDirectoryName(applicationPath); var programDataPath = Path.GetDirectoryName(systemPath); - return new ServerApplicationPaths(programDataPath, appFolderPath, resourcesPath); + return new ServerApplicationPaths(programDataPath, appFolderPath, resourcesPath, createDirectoryFn); } - return new ServerApplicationPaths(ApplicationPathHelper.GetProgramDataPath(applicationPath), appFolderPath, resourcesPath); + return new ServerApplicationPaths(ApplicationPathHelper.GetProgramDataPath(applicationPath), appFolderPath, resourcesPath, createDirectoryFn); } /// <summary> @@ -330,6 +337,8 @@ namespace MediaBrowser.ServerApplication var imageEncoder = ImageEncoderHelper.GetImageEncoder(_logger, logManager, fileSystem, options, () => _appHost.HttpClient, appPaths); + FileSystem = fileSystem; + _appHost = new WindowsAppHost(appPaths, logManager, options, @@ -580,7 +589,7 @@ namespace MediaBrowser.ServerApplication { var exception = (Exception)e.ExceptionObject; - new UnhandledExceptionWriter(_appHost.ServerConfigurationManager.ApplicationPaths, _logger, _appHost.LogManager).Log(exception); + new UnhandledExceptionWriter(_appHost.ServerConfigurationManager.ApplicationPaths, _logger, _appHost.LogManager, FileSystem, new ConsoleLogger()).Log(exception); if (!IsRunningAsService) { |
