24
24
This is a hook for Click packages. You can find information on Click package hooks in
25
25
the click documentation:
27
https://click-package.readthedocs.org/en/latest/
27
https://click.readthedocs.org/en/latest/
29
29
Probably the biggest thing to understand for how this code works is that you need to
30
30
understand that this hook is run after one, or many packages are installed. A set of
392
393
/* Check click to find out where the files are */
393
gchar * cmdline = g_strdup_printf("click pkgdir \"%s\"", package);
394
ClickUser * user = click_user_new_for_user(NULL, NULL, &error);
396
g_warning("Unable to read Click database: %s", error->message);
401
gchar * pkgdir = click_user_get_path(user, package, &error);
403
g_warning("Unable to get the Click package directory for %s: %s", package, error->message);
408
g_object_unref(user);
396
gchar * output = NULL;
397
g_spawn_command_line_sync(cmdline, &output, NULL, NULL, &error);
400
/* If we have an extra newline, we can hide it. */
401
if (output != NULL) {
402
gchar * newline = NULL;
404
newline = g_strstr_len(output, -1, "\n");
406
if (newline != NULL) {
412
g_warning("Unable to get the package directory from click: %s", error->message);
414
g_free(output); /* Probably not set, but just in case */
418
if (!g_file_test(output, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)) {
419
g_warning("Directory returned by click '%s' couldn't be found", output);
424
gchar * indesktop = manifest_to_desktop(output, state->app_id);
411
if (!g_file_test(pkgdir, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)) {
412
g_warning("Directory returned by click '%s' couldn't be found", pkgdir);
417
gchar * indesktop = manifest_to_desktop(pkgdir, state->app_id);
425
418
if (indesktop == NULL) {
432
425
gchar * desktoppath = g_build_filename(desktopdir, desktopfile, NULL);
433
426
g_free(desktopfile);
435
copy_desktop_file(indesktop, desktoppath, output, state->app_id);
428
copy_desktop_file(indesktop, desktoppath, pkgdir, state->app_id);
437
430
g_free(desktoppath);
438
431
g_free(indesktop);