From 629000f039cf74e95396c0d2c195790fcd8244e7 Mon Sep 17 00:00:00 2001 From: h_vogt Date: Sun, 26 Feb 2017 11:42:01 +0100 Subject: [PATCH] rawfile.c, no premature exit if directory not available, if just file name without path, simply hand it back. --- src/frontend/rawfile.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/frontend/rawfile.c b/src/frontend/rawfile.c index a8af304e4..b15309502 100644 --- a/src/frontend/rawfile.c +++ b/src/frontend/rawfile.c @@ -847,19 +847,20 @@ set_output_path(char *filename) if(!dirloc) dirloc = strrchr(ret, DIR_TERM_LINUX); #endif - if (dirloc) + if (dirloc) { fpath = copy_substring(ret, dirloc); + /* test if path exists */ + if (stat(fpath, &st) == 0) { + tfree(fpath); + return ret; + } + else { + fprintf(cp_err, "Error: Output path %s does not exist\n", fpath); + tfree(fpath); + return ret; /* fopen will catch this error */ + } + } + /* no path, just use the file name */ else - fpath = copy(ret); - /* test if path exists */ - if (stat(fpath, &st) == 0) { - tfree(fpath); return ret; - } - else { - fprintf(cp_err, "Error: Output path %s does not exist\n", fpath); - tfree(ret); - tfree(fpath); - controlled_exit(1); - } }