From d0c9273d679cfec73c10e6f863c5cf9012a3aa2f Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 23 May 2015 16:44:15 -0400 Subject: install service with Emby name --- MediaBrowser.ServerApplication/Native/Autorun.cs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'MediaBrowser.ServerApplication/Native') diff --git a/MediaBrowser.ServerApplication/Native/Autorun.cs b/MediaBrowser.ServerApplication/Native/Autorun.cs index 593bb7955..dd2a77565 100644 --- a/MediaBrowser.ServerApplication/Native/Autorun.cs +++ b/MediaBrowser.ServerApplication/Native/Autorun.cs @@ -18,17 +18,32 @@ namespace MediaBrowser.ServerApplication.Native { var shortcutPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.StartMenu), "Media Browser 3", "Media Browser Server.lnk"); + if (!Directory.Exists(Path.GetDirectoryName(shortcutPath))) + { + shortcutPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.StartMenu), "Emby", "Emby Server.lnk"); + } + var startupPath = Environment.GetFolderPath(Environment.SpecialFolder.Startup); + // Remove lnk from old name + try + { + fileSystem.DeleteFile(Path.Combine(startupPath, Path.GetFileName(shortcutPath) ?? "Media Browser Server.lnk")); + } + catch + { + + } + if (autorun) { //Copy our shortut into the startup folder for this user - File.Copy(shortcutPath, Path.Combine(startupPath, Path.GetFileName(shortcutPath) ?? "MBstartup.lnk"), true); + File.Copy(shortcutPath, Path.Combine(startupPath, Path.GetFileName(shortcutPath) ?? "Emby Server.lnk"), true); } else { //Remove our shortcut from the startup folder for this user - fileSystem.DeleteFile(Path.Combine(startupPath, Path.GetFileName(shortcutPath) ?? "MBstartup.lnk")); + fileSystem.DeleteFile(Path.Combine(startupPath, Path.GetFileName(shortcutPath) ?? "Emby Server.lnk")); } } } -- cgit v1.2.3