diff options
| author | Andrew Rabert <6550543+nvllsvm@users.noreply.github.com> | 2018-12-14 21:28:12 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-12-14 21:28:12 -0500 |
| commit | 46c75d75bd8702da4d3728c11f28756a9c9abb72 (patch) | |
| tree | dd6a198e3c104ebc732a615153c4bb5514e25660 /MediaBrowser.Server.Mono/ApplicationPathHelper.cs | |
| parent | b36b526f27ebd9ac716d743eea26e65407ceeea4 (diff) | |
| parent | a73d255f51f135adbc2c352fef79f776ce9fcb02 (diff) | |
Merge pull request #166 from jellyfin/develop
Develop
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; - } - } -} |
