Skip to content

Commit 55ffc15

Browse files
committed
Fix ocsigen_config_static.ml on Windows
1 parent 7c3ba04 commit 55ffc15

File tree

1 file changed

+25
-19
lines changed
  • src/files/ocsigenserver.conf

1 file changed

+25
-19
lines changed

src/files/ocsigenserver.conf/gen.ml

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,17 @@ let conf_in =
4141
</ocsigen>|}
4242

4343
let conf_ml =
44-
{|
45-
let version_number = "_VERSION_"
46-
let config_file = ref "_CONFIGDIR_/ocsigenserver.conf"
44+
{|(* Warning: this file has been generated - DO NOT MODIFY! *)
45+
46+
let version_number = _VERSION_
47+
let config_file = ref _CONFIGFILE_
4748
let is_native = Sys.backend_type = Sys.Native
48-
let logdir = ref (Some "_LOGDIR_")
49-
let mimefile = ref "_CONFIGDIR_/mime.types"
50-
let datadir = ref "_DATADIR_"
51-
let bindir = ref "_BINDIR_"
52-
let extdir = ref "_EXTDIR_"
53-
let command_pipe = ref "_COMMANDPIPE_"
49+
let logdir = ref (Some _LOGDIR_)
50+
let mimefile = ref _MIMEFILE_
51+
let datadir = ref _DATADIR_
52+
let bindir = ref _BINDIR_
53+
let extdir = ref _EXTDIR_
54+
let command_pipe = ref _COMMANDPIPE_
5455
let builtin_packages =
5556
List.fold_left
5657
(fun a s -> Ocsigen_lib.String.Set.add s a)
@@ -97,17 +98,22 @@ let deps () =
9798
ignore (Unix.close_process_in inp);
9899
!deps @ extra_deps
99100

101+
(* Encode a string as a string literal that can be included in an ocaml file. *)
102+
let str = Printf.sprintf "%S"
103+
let ( // ) = Filename.concat
104+
100105
let static_options = function
101-
| "VERSION" -> version
102-
| "WARNING" -> "Warning: this file has been generated - DO NOT MODIFY!"
103-
| "LOGDIR" -> logdir
104-
| "DATADIR" -> datadir
105-
| "BINDIR" -> bindir
106-
| "EXTDIR" -> libdir () ^ "/ocsigenserver/extensions"
107-
| "STATICPAGESDIR" -> staticpagesdir
108-
| "UP" -> uploaddir
109-
| "COMMANDPIPE" -> commandpipe
110-
| "CONFIGDIR" -> configdir
106+
| "VERSION" -> str version
107+
| "LOGDIR" -> str logdir
108+
| "DATADIR" -> str datadir
109+
| "BINDIR" -> str bindir
110+
| "EXTDIR" -> str (libdir () // "ocsigenserver" // "extensions")
111+
| "STATICPAGESDIR" -> str staticpagesdir
112+
| "UP" -> str uploaddir
113+
| "COMMANDPIPE" -> str commandpipe
114+
| "CONFIGDIR" -> str configdir
115+
| "CONFIGFILE" -> str (configdir // "ocsigenserver.conf")
116+
| "MIMEFILE" -> str (configdir // "mime.types")
111117
| "DEPS" -> String.concat ";" (List.map (Format.asprintf "%S") (deps ()))
112118
| _ as s -> failwith s
113119

0 commit comments

Comments
 (0)