diff options
author | Adam Chlipala <adam@chlipala.net> | 2019-01-21 18:09:59 -0500 |
---|---|---|
committer | Adam Chlipala <adam@chlipala.net> | 2019-01-21 18:09:59 -0500 |
commit | 87d2eab53f8e9f81cc459429675123c9ff36f41e (patch) | |
tree | 81b658d13942148ed6ab7f745b0514ab6ffcc232 /src/cjr_print.sml | |
parent | 38a20fdb9619e33ea989e171d98777cb3d7c6bc5 (diff) |
Basis.textOfBlob; try creating filecache directory if it doesn't exist
Diffstat (limited to 'src/cjr_print.sml')
-rw-r--r-- | src/cjr_print.sml | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/cjr_print.sml b/src/cjr_print.sml index 31653a74..09cd9c7f 100644 --- a/src/cjr_print.sml +++ b/src/cjr_print.sml @@ -3391,6 +3391,14 @@ fun p_file env (ds, ps) = newline, string "#include <time.h>", newline, + (case Settings.getFileCache () of + NONE => box [] + | SOME _ => box [string "#include <sys/types.h>", + newline, + string "#include <sys/stat.h>", + newline, + string "#include <unistd.h>", + newline]), if hasDb then box [string ("#include <" ^ #header (Settings.currentDbms ()) ^ ">"), newline] @@ -3655,7 +3663,21 @@ fun p_file env (ds, ps) = newline, string "static void uw_initializer(uw_context ctx) {", newline, - box [string "uw_begin_initializing(ctx);", + box [(case Settings.getFileCache () of + NONE => box [] + | SOME dir => box [newline, + string "struct stat st = {0};", + newline, + newline, + string "if (stat(\"", + string (Prim.toCString dir), + string "\", &st) == -1)", + newline, + box [string "mkdir(\"", + string (Prim.toCString dir), + string "\", 0700);", + newline]]), + string "uw_begin_initializing(ctx);", newline, p_list_sep newline (fn x => x) (rev (!global_initializers)), string "uw_end_initializing(ctx);", |