summaryrefslogtreecommitdiff
path: root/src/cjr_print.sml
diff options
context:
space:
mode:
authorGravatar Artyom Shalkhakov <artyom.shalkhakov@gmail.com>2019-01-27 15:51:22 +0200
committerGravatar Artyom Shalkhakov <artyom.shalkhakov@gmail.com>2019-01-27 15:51:22 +0200
commitff20f86eb6e792b69c2b580444bd9b051aaf7752 (patch)
tree89d1547b919a722c20de85fdd60d4117e1af54a7 /src/cjr_print.sml
parent726ff63ec6d084f2ef4d65b084ef204d5fcc5eb0 (diff)
parent28ab84cb7b09e23aa0ed014bf2ed1fda56fcefc1 (diff)
Merge branch 'master' of https://github.com/urweb/urweb into endpoints
Diffstat (limited to 'src/cjr_print.sml')
-rw-r--r--src/cjr_print.sml24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/cjr_print.sml b/src/cjr_print.sml
index 5983b9e5..d7416616 100644
--- a/src/cjr_print.sml
+++ b/src/cjr_print.sml
@@ -3393,6 +3393,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]
@@ -3657,7 +3665,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);",