diff options
Diffstat (limited to 'MediaBrowser.Common.Implementations/BaseApplicationHost.cs')
| -rw-r--r-- | MediaBrowser.Common.Implementations/BaseApplicationHost.cs | 22 |
1 files changed, 22 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> |
