extension-tool: Don't treat missing .js handler as error

After creating a new extension, we try to open the main source
file with the default handler, which fails when there is none.

But given that the extension was created successfully, don't treat
a missing handler as failure, and print the path to the new extension
instead.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/905
This commit is contained in:
Chuck 2019-12-19 11:00:51 -08:00 committed by Florian Müllner
parent fe106358f5
commit d1f87ca115

View File

@ -118,9 +118,14 @@ launch_extension_source (GFile *dir, GError **error)
GList l; GList l;
main_source = g_file_get_child (dir, "extension.js"); main_source = g_file_get_child (dir, "extension.js");
handler = g_file_query_default_handler (main_source, NULL, error); handler = g_file_query_default_handler (main_source, NULL, NULL);
if (handler == NULL) if (handler == NULL)
return FALSE; {
/* Translators: a file path to an extension directory */
g_print (_("The new extension was successfully created in %s.\n"),
g_file_peek_path (dir));
return TRUE;
}
l.data = main_source; l.data = main_source;
l.next = l.prev = NULL; l.next = l.prev = NULL;