aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukePulverenti <luke.pulverenti@gmail.com>2013-03-12 15:37:30 -0400
committerLukePulverenti <luke.pulverenti@gmail.com>2013-03-12 15:37:30 -0400
commitfb9387fa35745303622f959bfa4f43c799c9aa4f (patch)
treee8e51c911efb26a967ab9941b60ddcdfd6bc4641
parentf6f0e0e8cabaaffebbf746ae1c274b8858a292e9 (diff)
parent5954287cc377c312c73551d2e23239d418c2deab (diff)
Merge branch 'master' of https://github.com/MediaBrowser/MediaBrowser
-rw-r--r--MediaBrowser.Common.Implementations/BaseApplicationHost.cs22
-rw-r--r--MediaBrowser.ServerApplication/ApplicationHost.cs8
2 files changed, 30 insertions, 0 deletions
diff --git a/MediaBrowser.Common.Implementations/BaseApplicationHost.cs b/MediaBrowser.Common.Implementations/BaseApplicationHost.cs
index 57bf389fe..817018b49 100644
--- a/MediaBrowser.Common.Implementations/BaseApplicationHost.cs
+++ b/MediaBrowser.Common.Implementations/BaseApplicationHost.cs
@@ -473,10 +473,32 @@ namespace MediaBrowser.Common.Implementations
}
/// <summary>
+ /// Defines the full path to our shortcut in the start menu
+ /// </summary>
+ protected abstract string ProductShortcutPath { get; }
+
+ /// <summary>
/// Configures the auto run at startup.
/// </summary>
private void ConfigureAutoRunAtStartup()
{
+ if (ConfigurationManager.CommonConfiguration.RunAtStartup)
+ {
+ //Copy our shortut into the startup folder for this user
+ File.Copy(ProductShortcutPath, Environment.GetFolderPath(Environment.SpecialFolder.Startup), true);
+ }
+ else
+ {
+ //Remove our shortcut from the startup folder for this user
+ try
+ {
+ File.Delete(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Startup), Path.GetFileName(ProductShortcutPath)));
+ }
+ catch (FileNotFoundException)
+ {
+ //This is okay - trying to remove it anyway
+ }
+ }
}
/// <summary>
diff --git a/MediaBrowser.ServerApplication/ApplicationHost.cs b/MediaBrowser.ServerApplication/ApplicationHost.cs
index d5a505792..f9b2840f4 100644
--- a/MediaBrowser.ServerApplication/ApplicationHost.cs
+++ b/MediaBrowser.ServerApplication/ApplicationHost.cs
@@ -129,6 +129,14 @@ namespace MediaBrowser.ServerApplication
private IHttpServer HttpServer { get; set; }
/// <summary>
+ /// The full path to our startmenu shortcut
+ /// </summary>
+ protected override string ProductShortcutPath
+ {
+ get { return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.StartMenu), "Media Browser Server.lnk"); }
+ }
+
+ /// <summary>
/// Runs the startup tasks.
/// </summary>
/// <returns>Task.</returns>