From 08024c81de4c16fc4fd6639241b69d31e0c564b0 Mon Sep 17 00:00:00 2001 From: Phallacy Date: Tue, 11 Dec 2018 12:13:31 -0800 Subject: [PATCH] Changed the App.Config to longer break both nix (in debug mode) and windows (in release mode) profiles. Changed the Path helper library to replace %ApplicationData% in Windows land with the Userdata\roaming folder, and with /var/lib in nix land --- MediaBrowser.Server.Mono/ApplicationPathHelper.cs | 11 ++++++++++- MediaBrowser.Server.Mono/app.config | 4 ++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/MediaBrowser.Server.Mono/ApplicationPathHelper.cs b/MediaBrowser.Server.Mono/ApplicationPathHelper.cs index c8cca40ff8..ac55693fa2 100644 --- a/MediaBrowser.Server.Mono/ApplicationPathHelper.cs +++ b/MediaBrowser.Server.Mono/ApplicationPathHelper.cs @@ -1,6 +1,7 @@ using System; using System.Configuration; using System.IO; +using System.Runtime.InteropServices; namespace MediaBrowser.Server.Mono { @@ -22,7 +23,15 @@ namespace MediaBrowser.Server.Mono ConfigurationManager.AppSettings["DebugProgramDataPath"] : ConfigurationManager.AppSettings["ReleaseProgramDataPath"]; - programDataPath = programDataPath.Replace("%ApplicationData%", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)); + if (System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + programDataPath = programDataPath.Replace("%ApplicationData%", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)); + } + else + { + programDataPath = programDataPath.Replace("%ApplicationData%", "/var/lib"); + } + programDataPath = programDataPath .Replace('/', Path.DirectorySeparatorChar) diff --git a/MediaBrowser.Server.Mono/app.config b/MediaBrowser.Server.Mono/app.config index 42a9d04e7e..a93871625f 100644 --- a/MediaBrowser.Server.Mono/app.config +++ b/MediaBrowser.Server.Mono/app.config @@ -1,7 +1,7 @@  - - + + \ No newline at end of file