diff --git a/Nodejs/Product/Nodejs/NodejsToolsInstallPath.cs b/Nodejs/Product/Nodejs/NodejsToolsInstallPath.cs index 03509a6e9..994323585 100644 --- a/Nodejs/Product/Nodejs/NodejsToolsInstallPath.cs +++ b/Nodejs/Product/Nodejs/NodejsToolsInstallPath.cs @@ -17,65 +17,26 @@ using System; using System.IO; using System.Reflection; -using Microsoft.Win32; namespace Microsoft.NodejsTools { public static class NodejsToolsInstallPath { private static string GetFromAssembly(Assembly assembly, string filename) { string path = Path.Combine( Path.GetDirectoryName(assembly.Location), - filename - ); + filename); if (File.Exists(path)) { return path; } return string.Empty; } - private static string GetFromRegistry(string filename) { - const string ROOT_KEY = "Software\\Microsoft\\NodejsTools\\" + AssemblyVersionInfo.VSVersion; - - string installDir = null; - using (var baseKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32)) - using (var configKey = baseKey.OpenSubKey(ROOT_KEY)) { - if (configKey != null) { - installDir = configKey.GetValue("InstallDir") as string; - } - } - - if (string.IsNullOrEmpty(installDir)) { - using (var baseKey = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Registry32)) - using (var configKey = baseKey.OpenSubKey(ROOT_KEY)) { - if (configKey != null) { - installDir = configKey.GetValue("InstallDir") as string; - } - } - } - - if (!String.IsNullOrEmpty(installDir)) { - var path = Path.Combine(installDir, filename); - if (File.Exists(path)) { - return path; - } - } - - return string.Empty; - } - public static string GetFile(string filename) { string path = GetFromAssembly(typeof(NodejsToolsInstallPath).Assembly, filename); if (!string.IsNullOrEmpty(path)) { return path; } - path = GetFromRegistry(filename); - if (!string.IsNullOrEmpty(path)) { - return path; - } - - throw new InvalidOperationException( - "Unable to determine Node.js Tools installation path" - ); + throw new InvalidOperationException("Unable to determine Node.js Tools installation path"); } } } diff --git a/Nodejs/Product/Nodejs/Project/NodejsProjectNode.cs b/Nodejs/Product/Nodejs/Project/NodejsProjectNode.cs index b5a922c01..09ebc7cc3 100644 --- a/Nodejs/Product/Nodejs/Project/NodejsProjectNode.cs +++ b/Nodejs/Product/Nodejs/Project/NodejsProjectNode.cs @@ -1173,8 +1173,8 @@ protected override int ExecCommandThatDependsOnSelectedNodes(Guid cmdGroup, uint ); handled = true; return VSConstants.S_OK; - - case PkgCmdId.cmdidAddNewJavaScriptFileCommand: + + case PkgCmdId.cmdidAddNewJavaScriptFileCommand: NewFileMenuGroup.NewFileUtilities.CreateNewJavaScriptFile(projectNode: this, containerId: selectedNodes[0].ID); handled = true; return VSConstants.S_OK;