mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-02 13:58:29 +01:00
update components
This commit is contained in:
51
MediaBrowser.ServerApplication/ApplicationPathHelper.cs
Normal file
51
MediaBrowser.ServerApplication/ApplicationPathHelper.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
using System;
|
||||
using System.Configuration;
|
||||
using System.IO;
|
||||
|
||||
namespace MediaBrowser.ServerApplication
|
||||
{
|
||||
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"];
|
||||
|
||||
programDataPath = programDataPath.Replace("%ApplicationData%", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData));
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Server.Implementations;
|
||||
using MediaBrowser.Server.Startup.Common;
|
||||
using MediaBrowser.ServerApplication.Native;
|
||||
using MediaBrowser.ServerApplication.Splash;
|
||||
|
||||
@@ -113,6 +113,7 @@
|
||||
<Compile Include="..\SharedVersion.cs">
|
||||
<Link>Properties\SharedVersion.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="ApplicationPathHelper.cs" />
|
||||
<Compile Include="BackgroundService.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
@@ -244,10 +245,6 @@
|
||||
<Project>{442b5058-dcaf-4263-bb6a-f21e31120a1b}</Project>
|
||||
<Name>MediaBrowser.Providers</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\MediaBrowser.Server.Implementations\MediaBrowser.Server.Implementations.csproj">
|
||||
<Project>{2e781478-814d-4a48-9d80-bff206441a65}</Project>
|
||||
<Name>MediaBrowser.Server.Implementations</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\MediaBrowser.WebDashboard\MediaBrowser.WebDashboard.csproj">
|
||||
<Project>{5624b7b5-b5a7-41d8-9f10-cc5611109619}</Project>
|
||||
<Name>MediaBrowser.WebDashboard</Name>
|
||||
|
||||
Reference in New Issue
Block a user