private OperationLockInfo ReadLockInfo() { try { return(JsonConvert.DeserializeObject <OperationLockInfo>(FileSystemHelpers.ReadAllTextFromFile(_path)) ?? new OperationLockInfo { OperationName = "unknown" }); } catch (Exception ex) { _traceFactory.GetTracer().TraceError(ex); return(new OperationLockInfo { OperationName = "unknown", StackTrace = ex.ToString() }); }; }
private static string ResolveNpmVersion(string nodeVersion) { string programFiles = SystemEnvironment.GetFolderPath(SystemEnvironment.SpecialFolder.ProgramFilesX86); string appSettingNpmVersion = SystemEnvironment.GetEnvironmentVariable("WEBSITE_NPM_DEFAULT_VERSION"); if (!string.IsNullOrEmpty(appSettingNpmVersion)) { return(appSettingNpmVersion); } else if (nodeVersion.Equals("4.1.2", StringComparison.OrdinalIgnoreCase)) { // This case is only to work around node version 4.1.2 with npm 2.x failing to publish ASP.NET 5 apps due to long path issues. return("3.3.6"); } else { string npmTxtPath = Path.Combine(programFiles, "nodejs", nodeVersion, "npm.txt"); return(FileSystemHelpers.FileExists(npmTxtPath) ? FileSystemHelpers.ReadAllTextFromFile(npmTxtPath).Trim() : DefaultNpmVersion); } }