diff --git a/MediaBrowser.Common.Implementations/BaseApplicationPaths.cs b/MediaBrowser.Common.Implementations/BaseApplicationPaths.cs
index 2940f921c8..4ad63b2e3f 100644
--- a/MediaBrowser.Common.Implementations/BaseApplicationPaths.cs
+++ b/MediaBrowser.Common.Implementations/BaseApplicationPaths.cs
@@ -14,24 +14,12 @@ namespace MediaBrowser.Common.Implementations
///
protected BaseApplicationPaths(string programDataPath, string applicationPath)
{
- _programDataPath = programDataPath;
+ ProgramDataPath = programDataPath;
ApplicationPath = applicationPath;
}
public string ApplicationPath { get; private set; }
-
- ///
- /// The _program data path
- ///
- private readonly string _programDataPath;
- ///
- /// Gets the path to the program data folder
- ///
- /// The program data path.
- public string ProgramDataPath
- {
- get { return _programDataPath; }
- }
+ public string ProgramDataPath { get; private set; }
///
/// Gets the path to the system folder
diff --git a/MediaBrowser.Controller/IServerApplicationPaths.cs b/MediaBrowser.Controller/IServerApplicationPaths.cs
index 34137088fd..e3438c3d25 100644
--- a/MediaBrowser.Controller/IServerApplicationPaths.cs
+++ b/MediaBrowser.Controller/IServerApplicationPaths.cs
@@ -10,6 +10,13 @@ namespace MediaBrowser.Controller
/// The root folder path.
string RootFolderPath { get; }
+ ///
+ /// Gets the application resources path. This is the path to the folder containing resources that are deployed as part of the application
+ /// For example, this folder contains dashboard-ui and swagger-ui
+ ///
+ /// The application resources path.
+ string ApplicationResourcesPath { get; }
+
///
/// Gets the path to the default user view directory. Used if no specific user view is defined.
///
diff --git a/MediaBrowser.Server.Implementations/HttpServer/SwaggerService.cs b/MediaBrowser.Server.Implementations/HttpServer/SwaggerService.cs
index 3764697f1e..aeaac80e88 100644
--- a/MediaBrowser.Server.Implementations/HttpServer/SwaggerService.cs
+++ b/MediaBrowser.Server.Implementations/HttpServer/SwaggerService.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Common.Configuration;
+using MediaBrowser.Controller;
using MediaBrowser.Controller.Net;
using ServiceStack.Web;
using System.IO;
@@ -7,9 +7,9 @@ namespace MediaBrowser.Server.Implementations.HttpServer
{
public class SwaggerService : IHasResultFactory, IRestfulService
{
- private readonly IApplicationPaths _appPaths;
+ private readonly IServerApplicationPaths _appPaths;
- public SwaggerService(IApplicationPaths appPaths)
+ public SwaggerService(IServerApplicationPaths appPaths)
{
_appPaths = appPaths;
}
@@ -21,9 +21,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
/// System.Object.
public object Get(GetSwaggerResource request)
{
- var runningDirectory = Path.GetDirectoryName(_appPaths.ApplicationPath);
-
- var swaggerDirectory = Path.Combine(runningDirectory, "swagger-ui");
+ var swaggerDirectory = Path.Combine(_appPaths.ApplicationResourcesPath, "swagger-ui");
var requestedFile = Path.Combine(swaggerDirectory, request.ResourceName.Replace('/', Path.DirectorySeparatorChar));
diff --git a/MediaBrowser.Server.Implementations/ServerApplicationPaths.cs b/MediaBrowser.Server.Implementations/ServerApplicationPaths.cs
index 68956be183..d9973afe78 100644
--- a/MediaBrowser.Server.Implementations/ServerApplicationPaths.cs
+++ b/MediaBrowser.Server.Implementations/ServerApplicationPaths.cs
@@ -12,12 +12,14 @@ namespace MediaBrowser.Server.Implementations
///
/// Initializes a new instance of the class.
///
- public ServerApplicationPaths(string programDataPath, string applicationPath)
+ public ServerApplicationPaths(string programDataPath, string applicationPath, string applicationResourcesPath)
: base(programDataPath, applicationPath)
{
-
+ ApplicationResourcesPath = applicationResourcesPath;
}
+ public string ApplicationResourcesPath { get; private set; }
+
///
/// Gets the path to the base root media directory
///
diff --git a/MediaBrowser.Server.Mono/Program.cs b/MediaBrowser.Server.Mono/Program.cs
index 0df213d900..1cd0b5ae6b 100644
--- a/MediaBrowser.Server.Mono/Program.cs
+++ b/MediaBrowser.Server.Mono/Program.cs
@@ -1,3 +1,4 @@
+using System.IO;
using MediaBrowser.Common.Implementations.IO;
using MediaBrowser.Common.Implementations.Logging;
using MediaBrowser.Model.Logging;
@@ -58,10 +59,10 @@ namespace MediaBrowser.Server.Mono
{
if (string.IsNullOrEmpty(programDataPath))
{
- return new ServerApplicationPaths(ApplicationPathHelper.GetProgramDataPath(applicationPath), applicationPath);
+ programDataPath = ApplicationPathHelper.GetProgramDataPath(applicationPath);
}
- return new ServerApplicationPaths(programDataPath, applicationPath);
+ return new ServerApplicationPaths(programDataPath, applicationPath, Path.GetDirectoryName(applicationPath));
}
private static readonly TaskCompletionSource ApplicationTaskCompletionSource = new TaskCompletionSource();
diff --git a/MediaBrowser.ServerApplication/MainStartup.cs b/MediaBrowser.ServerApplication/MainStartup.cs
index 36430e642f..af0219bda9 100644
--- a/MediaBrowser.ServerApplication/MainStartup.cs
+++ b/MediaBrowser.ServerApplication/MainStartup.cs
@@ -153,16 +153,18 @@ namespace MediaBrowser.ServerApplication
/// ServerApplicationPaths.
private static ServerApplicationPaths CreateApplicationPaths(string applicationPath, bool runAsService)
{
+ var resourcesPath = Path.GetDirectoryName(applicationPath);
+
if (runAsService)
{
var systemPath = Path.GetDirectoryName(applicationPath);
var programDataPath = Path.GetDirectoryName(systemPath);
- return new ServerApplicationPaths(programDataPath, applicationPath);
+ return new ServerApplicationPaths(programDataPath, applicationPath, resourcesPath);
}
- return new ServerApplicationPaths(ApplicationPathHelper.GetProgramDataPath(applicationPath), applicationPath);
+ return new ServerApplicationPaths(ApplicationPathHelper.GetProgramDataPath(applicationPath), applicationPath, resourcesPath);
}
///
diff --git a/MediaBrowser.WebDashboard/Api/PackageCreator.cs b/MediaBrowser.WebDashboard/Api/PackageCreator.cs
index ff61af0f30..39fcce57d7 100644
--- a/MediaBrowser.WebDashboard/Api/PackageCreator.cs
+++ b/MediaBrowser.WebDashboard/Api/PackageCreator.cs
@@ -87,9 +87,7 @@ namespace MediaBrowser.WebDashboard.Api
return _config.Configuration.DashboardSourcePath;
}
- var runningDirectory = Path.GetDirectoryName(_config.ApplicationPaths.ApplicationPath);
-
- return Path.Combine(runningDirectory, "dashboard-ui");
+ return Path.Combine(_config.ApplicationPaths.ApplicationResourcesPath, "dashboard-ui");
}
}