public static string GetTracerHomePath() { var tracerHomeDirectoryEnvVar = "TracerHomeDirectory"; var tracerHome = Environment.GetEnvironmentVariable(tracerHomeDirectoryEnvVar); if (string.IsNullOrEmpty(tracerHome)) { // default return(Path.Combine( GetMonitoringHomePath(), "tracer")); } if (!Directory.Exists(tracerHome)) { throw new InvalidOperationException($"{tracerHomeDirectoryEnvVar} was set to '{tracerHome}', but directory does not exist"); } // basic verification var tfmDirectory = EnvironmentTools.GetTracerTargetFrameworkDirectory(); var dllLocation = Path.Combine(tracerHome, tfmDirectory); if (!Directory.Exists(dllLocation)) { throw new InvalidOperationException($"{tracerHomeDirectoryEnvVar} was set to '{tracerHome}', but location does not contain expected folder '{tfmDirectory}'"); } return(tracerHome); }
internal static string GetProfilerTargetFolder() { var tracerHome = EnvironmentHelper.GetTracerHomePath(); var targetFrameworkDirectory = EnvironmentTools.GetTracerTargetFrameworkDirectory(); var finalDirectory = Path.Combine(tracerHome, targetFrameworkDirectory); if (Directory.Exists(finalDirectory)) { return(finalDirectory); } return(null); }