From: Ulrich Eckhardt Date: Wed, 15 Jun 2011 09:38:08 +0000 (+0000) Subject: From: Ulrich Eckhardt X-Git-Tag: submit/2.0alpha-wayland/20121127.221958~756 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=03dca9b10352c3f4db3359c33e2766cdaf52368d;p=profile%2Fivi%2Fedje.git From: Ulrich Eckhardt Subject: [E-devel] Provide sensible errors for edje utilities If you start edje_player or edje_inspector with a path to a file that doesn't exist you get a bogus error message saying that the file doesn't contain any groups. The attached patch uses access() to check if the program can read the file, giving a sensible error message if not. I have checked the other utilities there, too, and they work, with the exception of edje_external_inspector. I'm not sure how this one works at all, but it seems not to take a file but a list of modules, maybe someone with greater insight can take a look at that. Going through things installed under bin, I'll take a look if those behave properly and create patches for those, too, if this one is okay. git-svn-id: http://svn.enlightenment.org/svn/e/trunk/edje@60338 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- diff --git a/src/bin/edje_inspector.c b/src/bin/edje_inspector.c index f422eba..ed3baaf 100644 --- a/src/bin/edje_inspector.c +++ b/src/bin/edje_inspector.c @@ -11,6 +11,7 @@ #include #include #include +#include static int _log_dom; #define DBG(...) EINA_LOG_DOM_DBG(_log_dom, __VA_ARGS__) @@ -1577,6 +1578,15 @@ main(int argc, char **argv) file = argv[arg_index]; + // check if the file is accessible + if (access(file, R_OK) == -1) + { + int e = errno; + ERR("File '%s' not accessible, error %d (%s).\n", + file, e, strerror(e)); + ret = 1; + goto error_getopt; + } DBG("mode=%s, detail=%d(%s), group=%s, part=%s, program=%s, api-only=" FMT_UCHAR ", api-fix=" FMT_UCHAR ", machine=" FMT_UCHAR ", file=%s", diff --git a/src/bin/edje_player.c b/src/bin/edje_player.c index 1e861cc..4d0c0a3 100644 --- a/src/bin/edje_player.c +++ b/src/bin/edje_player.c @@ -674,6 +674,15 @@ int main(int argc, char **argv) ecore_app_args_set(argc, (const char **)argv); edje_scale_set(opts.scale); + // check if the given edj file is there + if (access(argv[args], R_OK) == -1) + { + int e = errno; + fprintf(stderr, "ERROR: file '%s' not accessible, error %d (%s).\n", + argv[args], e, strerror(e)); + goto end; + } + opts.file = argv[args]; if (opts.list_groups) {