tfix output folder creation, file write - slidergrid - grid of elastic sliders on a frictional surface
 (HTM) git clone git://src.adamsgaard.dk/slidergrid
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 44ac43e2f25e201fcc9f6ee771ffc4de2819ba7a
 (DIR) parent 835f19fe0b2edc041905949cdd48466a743ed440
 (HTM) Author: Anders Damsgaard <anders.damsgaard@geo.au.dk>
       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(-)
       ---
 (DIR) 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 $@
        
 (DIR) 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) {