summaryrefslogtreecommitdiff
path: root/src/LV2-render.c
diff options
context:
space:
mode:
authoryo mama <pepper@scannerjammer.com>2015-01-31 00:19:49 -0800
committeryo mama <pepper@scannerjammer.com>2015-01-31 00:19:49 -0800
commitf2a5461bccc641c99ef6d8569a1e0484e279c1e3 (patch)
tree0404684e15519e127ff2e0b2deaf8cc392631912 /src/LV2-render.c
parent7557adc6776004d4f21bd88be07b6551ba66f13f (diff)
added file checking
Diffstat (limited to 'src/LV2-render.c')
-rw-r--r--src/LV2-render.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/LV2-render.c b/src/LV2-render.c
index 490f1ae..124c6dd 100644
--- a/src/LV2-render.c
+++ b/src/LV2-render.c
@@ -79,6 +79,9 @@
#include "midi/fluidsynth_priv.h"
#define DEBUG 0
+#define FILE_OK 0x0
+#define WRITE_OK 0x2
+
int min(int x, int y) {
return (x < y) ? x : y;
@@ -592,6 +595,19 @@ main(int argc, char** argv)
strcpy(jalv.opts.infile, "test.mid");
}
+
+ //make sure input and output exist
+ if(access(jalv.opts.infile, FILE_OK)){
+ fprintf(stderr, "ERROR:Could not find %s\n Please specify an input file with -i\n", jalv.opts.infile);
+ exit(1);
+ }
+ if(!access(jalv.opts.outfile, WRITE_OK)){
+ fprintf(stderr, "ERROR:Could not write to %s\n.", jalv.opts.outfile);
+ exit(1);
+ }
+
+
+
if (! jalv.opts.sample_rate){
jalv.opts.sample_rate = 48000;
}