aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Mono/Program.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Server.Mono/Program.cs')
-rw-r--r--MediaBrowser.Server.Mono/Program.cs18
1 files changed, 15 insertions, 3 deletions
diff --git a/MediaBrowser.Server.Mono/Program.cs b/MediaBrowser.Server.Mono/Program.cs
index e1d3cda40..b849c7a44 100644
--- a/MediaBrowser.Server.Mono/Program.cs
+++ b/MediaBrowser.Server.Mono/Program.cs
@@ -41,10 +41,8 @@ namespace MediaBrowser.Server.Mono
var applicationPath = Assembly.GetEntryAssembly ().Location;
#endif
- var commandArgs = Environment.GetCommandLineArgs();
-
// Allow this to be specified on the command line.
- var customProgramDataPath = commandArgs.ElementAtOrDefault(1);
+ var customProgramDataPath = ParseCommandLine();
var appPaths = CreateApplicationPaths(applicationPath, customProgramDataPath);
@@ -75,6 +73,20 @@ namespace MediaBrowser.Server.Mono
_appHost.Dispose();
}
}
+
+ private static string ParseCommandLine()
+ {
+ var commandArgs = Environment.GetCommandLineArgs().ToList();
+
+ var programDataPathIndex = commandArgs.IndexOf("-programdata");
+
+ if (programDataPathIndex != -1)
+ {
+ return commandArgs.ElementAtOrDefault(programDataPathIndex + 1);
+ }
+
+ return null;
+ }
private static ServerApplicationPaths CreateApplicationPaths(string applicationPath, string programDataPath)
{