From ca6a33731de13230629f493595721944807f5ac5 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 12 Jan 2012 20:50:21 +0000 Subject: Support passing either a file or the bundle directory for -l. git-svn-id: http://svn.drobilla.net/lad/trunk/jalv@3936 a436a847-0d15-0410-975c-d299462d15a1 --- src/jalv.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'src/jalv.c') diff --git a/src/jalv.c b/src/jalv.c index 20e1fb3..15fcd9e 100644 --- a/src/jalv.c +++ b/src/jalv.c @@ -16,13 +16,16 @@ #define _POSIX_C_SOURCE 200809L /* for mkdtemp */ +#include #include #include #include #include #include #include -#include +#include +#include +#include #include "jalv_internal.h" #include "jalv-config.h" @@ -610,9 +613,16 @@ main(int argc, char** argv) LilvState* state = NULL; LilvNode* plugin_uri = NULL; if (host.opts.load) { - char* path = jalv_strjoin(host.opts.load, "/state.ttl"); - state = lilv_state_new_from_file(host.world, &host.map, NULL, path); - free(path); + struct stat info; + stat(host.opts.load, &info); + if (S_ISDIR(info.st_mode)) { + char* path = jalv_strjoin(host.opts.load, "/state.ttl"); + state = lilv_state_new_from_file(host.world, &host.map, NULL, path); + free(path); + } else { + state = lilv_state_new_from_file(host.world, &host.map, NULL, + host.opts.load); + } if (!state) { fprintf(stderr, "Failed to load state from %s\n", host.opts.load); return EXIT_FAILURE; -- cgit v1.2.1