From 0e9125619c6a9385c5f1f107e53a4bf89fb5b96c Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sat, 24 Sep 2016 16:04:04 -0400 Subject: [PATCH] Improve an error message When the build directory does not exist or looks uninitialized in flatpak build, report a helpful message that points at flatpak build-init. --- app/flatpak-builtins-build.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/flatpak-builtins-build.c b/app/flatpak-builtins-build.c index 39d0e912..8f169a2f 100644 --- a/app/flatpak-builtins-build.c +++ b/app/flatpak-builtins-build.c @@ -116,8 +116,12 @@ flatpak_builtin_build (int argc, char **argv, GCancellable *cancellable, GError command = argv[rest_argv_start + 1]; app_deploy = g_file_new_for_commandline_arg (directory); - metadata = g_file_get_child (app_deploy, "metadata"); + + if (!g_file_query_exists (app_deploy, NULL) || + !g_file_query_exists (metadata, NULL)) + return flatpak_fail (error, _("Build directory %s not initialized, use flatpak build-init"), directory); + if (!g_file_load_contents (metadata, cancellable, &metadata_contents, &metadata_size, NULL, error)) return FALSE;