public CustomPathOptions(IGeneralOptions options = null) { try { if (options == null) { options = GetFromDialogPage(); } JavaPath = options.JavaPath; NpmPath = options.NpmPath; NSwagPath = options.NSwagPath; SwaggerCodegenPath = options.SwaggerCodegenPath; OpenApiGeneratorPath = options.OpenApiGeneratorPath; } catch (Exception e) { JavaPath = PathProvider.GetJavaPath(); NpmPath = PathProvider.GetNpmPath(); NSwagPath = PathProvider.GetNSwagPath(); SwaggerCodegenPath = PathProvider.GetSwaggerCodegenPath(); OpenApiGeneratorPath = PathProvider.GetOpenApiGeneratorPath(); Trace.WriteLine(e); Trace.WriteLine(Environment.NewLine); Trace.WriteLine("Error reading user options. Reverting to default values"); Trace.WriteLine($"JavaPath = {JavaPath}"); Trace.WriteLine($"NpmPath = {NpmPath}"); Trace.WriteLine($"NSwagPath = {NSwagPath}"); Trace.WriteLine($"SwaggerCodegenPath = {SwaggerCodegenPath}"); Trace.WriteLine($"OpenApiGeneratorPath = {OpenApiGeneratorPath}"); } }
public string GetJavaExePath() { var javaPath = options.JavaPath; if (!string.IsNullOrWhiteSpace(javaPath) && (File.Exists(javaPath) || javaPath != "java")) { return(javaPath); } try { Trace.WriteLine("Checking Java version"); ProcessHelper.StartProcess("java", "-version"); return("java"); } catch (Exception e) { Trace.WriteLine("Java not installed using default settings"); Trace.WriteLine(e); } if (string.IsNullOrWhiteSpace(options.JavaPath)) { javaPath = PathProvider.GetJavaPath(); } if (File.Exists(javaPath)) { return(javaPath); } throw new NotInstalledException("Unable to find Java"); }
public GeneralOptionPage() { JavaPath = PathProvider.GetJavaPath(); NpmPath = PathProvider.GetNpmPath(); NSwagPath = PathProvider.GetNSwagPath(); }