Skip to content

Commit b82e2fd

Browse files
johnyfdamiendoligez
andcommitted
ENH: add command-line parameter --cache-dir
This parameter corresponds to the variable `TLAPM_CACHE_DIR` of the runtime environment. This commit includes suggestions from code review of pull request: <#47> Co-authored-by: Damien Doligez <[email protected]>
1 parent 5d8be1d commit b82e2fd

File tree

4 files changed

+15
-0
lines changed

4 files changed

+15
-0
lines changed

src/params.ml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,7 @@ stores fingerprint and auxiliary
353353
files. This directory can be defined:
354354
- via the environment variable
355355
that is read below, or
356+
- via the command-line option
356357
`--cache-dir`
357358
*)
358359
let cachedir = ref ""
@@ -361,6 +362,7 @@ let () =
361362
cachedir := Sys.getenv "TLAPM_CACHE_DIR";
362363
with Not_found ->
363364
cachedir := ".tlacache"
365+
let set_tlapm_cache_dir dir = cachedir := dir
364366

365367

366368
let keep_going = ref false

src/params.mli

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ val keep_going : bool ref;; (* FIXME check still used ? *)
9090
val suppress_all : bool ref;;
9191
val set_smt_logic : string -> unit;;
9292
val set_smt_solver : string -> unit;;
93+
val set_tlapm_cache_dir : string -> unit;;
9394
val printconfig : bool -> string;;
9495
val print_config_toolbox : bool -> string;;
9596
val check_zenon_ver : unit -> unit;;

src/tlapm.ml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ let mkdir_tlaps t =
6868
cache directory at the path \
6969
`%s`. Please ensure that if \
7070
a path is given via the \
71+
command-line parameter \
72+
`--cache-dir`, or via the \
7173
variable `TLAPM_CACHE_DIR` of \
7274
the runtime environment, \
7375
that a directory at that path \

src/tlapm_args.ml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,16 @@ let init () =
212212
"<f> load fingerprints from file <f> (save as usual)";
213213
"--fpp", Arg.Set fp_deb,
214214
" print the fingerprints of obligations in toolbox messages";
215+
"--cache-dir", Arg.String set_tlapm_cache_dir,
216+
"<directory> save auxiliary and \
217+
temporary files under <directory>. \
218+
Alternatively, this directory \
219+
can be defined via the variable \
220+
`TLAPM_CACHE_DIR` of the runtime \
221+
environment. The command-line \
222+
parameter takes precedence over \
223+
the environment variable. If neither \
224+
is specified, the default value is \".tlacache\".";
215225
]
216226
in
217227
let opts = Arg.align opts in

0 commit comments

Comments
 (0)