diff options
author | David Robillard <d@drobilla.net> | 2012-01-12 20:50:21 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-01-12 20:50:21 +0000 |
commit | ca6a33731de13230629f493595721944807f5ac5 (patch) | |
tree | ee705df7fa85ece723e89b60c61c124a2c7f7b33 | |
parent | 3e28bd747843c220eb621007bbe60fa77f1cb607 (diff) | |
download | jalv-ca6a33731de13230629f493595721944807f5ac5.tar.gz jalv-ca6a33731de13230629f493595721944807f5ac5.tar.bz2 jalv-ca6a33731de13230629f493595721944807f5ac5.zip |
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
-rw-r--r-- | src/jalv.c | 18 |
1 files changed, 14 insertions, 4 deletions
@@ -16,13 +16,16 @@ #define _POSIX_C_SOURCE 200809L /* for mkdtemp */ +#include <assert.h> #include <math.h> #include <signal.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <assert.h> +#include <sys/stat.h> +#include <sys/types.h> +#include <unistd.h> #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; |