Beispiel #1
0
        private static void ProfileProject(SessionNode session, EnvDTE.Project projectToProfile, bool openReport) {
            var project = projectToProfile.AsPythonProject();

            var config = project?.GetLaunchConfigurationOrThrow();
            if (config == null) {
                MessageBox.Show("Could not find interpreter for project {0}".FormatUI(projectToProfile.Name), Strings.ProductTitle);
                return;
            }

            if (string.IsNullOrEmpty(config.ScriptName)) {
                MessageBox.Show("Project has no configured startup file, cannot start profiling.", Strings.ProductTitle);
                return;
            }

            if (string.IsNullOrEmpty(config.WorkingDirectory) || config.WorkingDirectory == ".") {
                config.WorkingDirectory = project.ProjectHome;
                if (string.IsNullOrEmpty(config.WorkingDirectory)) {
                    config.WorkingDirectory = Path.GetDirectoryName(config.ScriptName);
                }
            }

            RunProfiler(session, config, openReport);
        }