sysprof: allow passing program path to sysprof

If the path provided to us is an executable program (instead of a syscap
file) then we can setup the path as the binary to execute in the profiler
assistant and save the user a couple clicks.
This commit is contained in:
Christian Hergert
2020-01-23 11:59:07 -08:00
parent 599ecaebe1
commit 731b6dd379
3 changed files with 33 additions and 3 deletions

View File

@ -1032,10 +1032,19 @@ sysprof_display_open (SysprofDisplay *self,
g_return_if_fail (g_file_is_native (file));
g_return_if_fail (sysprof_display_is_empty (self));
g_set_object (&priv->file, file);
path = g_file_get_path (file);
/* If the file is executable, just set the path to the binary
* in the profiler assistant.
*/
if (g_file_test (path, G_FILE_TEST_IS_EXECUTABLE))
{
sysprof_profiler_assistant_set_executable (priv->assistant, path);
return;
}
g_set_object (&priv->file, file);
if (!(reader = sysprof_capture_reader_new (path, &error)))
g_warning ("Failed to open capture: %s", error->message);
else