From c7086364beeec2a7259aa2804361fcca8a586c53 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Mon, 20 Mar 2017 17:53:20 +0100 Subject: [PATCH] builder: Handle absolute paths in command Don't fail with "not found" in this case because we're checking the absolute path on the host, not in the final sandbox. --- builder/builder-manifest.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/builder/builder-manifest.c b/builder/builder-manifest.c index e607a688..9792d73a 100644 --- a/builder/builder-manifest.c +++ b/builder/builder-manifest.c @@ -2057,10 +2057,19 @@ builder_manifest_finish (BuilderManifest *self, if (self->command) { - g_autoptr(GFile) bin_dir = g_file_resolve_relative_path (app_dir, "files/bin"); - g_autoptr(GFile) bin_command = g_file_get_child (bin_dir, self->command); + g_autoptr(GFile) files_dir = g_file_resolve_relative_path (app_dir, "files"); + g_autoptr(GFile) command_file = NULL; - if (!g_file_query_exists (bin_command, NULL)) + if (!g_path_is_absolute (self->command)) + { + g_autoptr(GFile) bin_dir = g_file_resolve_relative_path (files_dir, "bin"); + command_file = g_file_get_child (bin_dir, self->command); + } + else if (g_str_has_prefix (self->command, "/app/")) + command_file = g_file_resolve_relative_path (files_dir, self->command + strlen ("/app/")); + + if (command_file != NULL && + !g_file_query_exists (command_file, NULL)) { const char *help = "";