tfix output folder creation, file write - slidergrid - grid of elastic sliders … | |
git clone git://src.adamsgaard.dk/slidergrid | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 44ac43e2f25e201fcc9f6ee771ffc4de2819ba7a | |
parent 835f19fe0b2edc041905949cdd48466a743ed440 | |
Author: Anders Damsgaard <[email protected]> | |
Date: Thu, 17 Mar 2016 10:19:55 -0700 | |
fix output folder creation, file write | |
Diffstat: | |
M Makefile | 2 ++ | |
M slidergrid/main.c | 15 ++++++++++++--- | |
2 files changed, 14 insertions(+), 3 deletions(-) | |
--- | |
diff --git a/Makefile b/Makefile | |
t@@ -10,6 +10,8 @@ ESSENTIALOBJS=$(SRCFOLDER)/main.o \ | |
$(SRCFOLDER)/simulation.o | |
BIN=test | |
+default: debug | |
+ | |
test: test.o $(ESSENTIALOBJS) | |
$(CC) $(LDLIBS) $^ -o $@ | |
diff --git a/slidergrid/main.c b/slidergrid/main.c | |
t@@ -100,10 +100,17 @@ int main(int argc, char** argv) | |
// create output file directory with simulation id as name and placed in | |
// current folder if it doesn't already exist | |
char output_folder[400]; | |
- sprintf(output_folder, "./%s/", sim.id); | |
+ sprintf(output_folder, "%s-output", sim.id); | |
struct stat st = {0}; | |
- if (stat(output_folder, &st) == -1) | |
- mkdir(output_folder, 0700); | |
+ int status; | |
+ if (stat(output_folder, &st) == -1) { | |
+ if (status = mkdir(output_folder, | |
+ S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH)) { | |
+ fprintf(stderr, "Error: Could not create output folder '%s' (%d)\n… | |
+ output_folder); | |
+ return 1; | |
+ } | |
+ } | |
// main temporal loop | |
sim.iteration = 0; | |
t@@ -147,6 +154,8 @@ int main(int argc, char** argv) | |
"'%s'.\n", filename); | |
return EXIT_FAILURE; | |
} | |
+ | |
+ time_since_file = 0.0; | |
} | |
if (verbose) { |