diff options
| author | Andrew Rabert <6550543+nvllsvm@users.noreply.github.com> | 2018-12-13 18:44:39 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-12-13 18:44:39 -0500 |
| commit | bdc2655a78e3162b7983ab12ed113cedccf55408 (patch) | |
| tree | 990e3e53fcf3f5c69f8ee000ea2bae1623b98e80 /MediaBrowser.Server.Mono/ApplicationPathHelper.cs | |
| parent | 64805410c21b1e4717a7f030f619bb2e7bd33d2a (diff) | |
| parent | b79f6e4ba0c2aa761b2fe016ca531dfdf6273b0e (diff) | |
Merge pull request #97 from Bond-009/home
Move default data folder for *nix platforms to $XDG_DATA_HOME/jellyfin
Diffstat (limited to 'MediaBrowser.Server.Mono/ApplicationPathHelper.cs')
| -rw-r--r-- | MediaBrowser.Server.Mono/ApplicationPathHelper.cs | 60 |
1 files changed, 0 insertions, 60 deletions
diff --git a/MediaBrowser.Server.Mono/ApplicationPathHelper.cs b/MediaBrowser.Server.Mono/ApplicationPathHelper.cs deleted file mode 100644 index ac55693fa..000000000 --- a/MediaBrowser.Server.Mono/ApplicationPathHelper.cs +++ /dev/null @@ -1,60 +0,0 @@ -using System; -using System.Configuration; -using System.IO; -using System.Runtime.InteropServices; - -namespace MediaBrowser.Server.Mono -{ - public static class ApplicationPathHelper - { - /// <summary> - /// Gets the path to the application's ProgramDataFolder - /// </summary> - /// <returns>System.String.</returns> - public static string GetProgramDataPath(string applicationPath) - { - var useDebugPath = false; - -#if DEBUG - useDebugPath = true; -#endif - - var programDataPath = useDebugPath ? - ConfigurationManager.AppSettings["DebugProgramDataPath"] : - ConfigurationManager.AppSettings["ReleaseProgramDataPath"]; - - 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) - .Replace('\\', Path.DirectorySeparatorChar); - - // If it's a relative path, e.g. "..\" - if (!Path.IsPathRooted(programDataPath)) - { - var path = Path.GetDirectoryName(applicationPath); - - if (string.IsNullOrEmpty(path)) - { - throw new ApplicationException("Unable to determine running assembly location"); - } - - programDataPath = Path.Combine(path, programDataPath); - - programDataPath = Path.GetFullPath(programDataPath); - } - - Directory.CreateDirectory(programDataPath); - - return programDataPath; - } - } -} |
