Skip to content

Commit

Permalink
cross platform access to temporary dir
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Diemand <[email protected]>
  • Loading branch information
CodiePP committed Aug 27, 2024
1 parent ebbb52a commit 5b45754
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 11 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,5 @@ testCHAR
/html
/mlihtml

dist/
docker/output/
2 changes: 1 addition & 1 deletion bin/lxr_backup.ml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ let arg_dryrun = ref false
let arg_files = ref []
let arg_recursive = ref false
let arg_directory = ref ""
let arg_dbpath = ref "/tmp/db"
let arg_dbpath = ref (Filename.concat (Filename.get_temp_dir_name ()) "db")
let arg_chunkpath = ref "lxr"
let arg_nchunks = ref 16
let arg_myid = ref def_myid
Expand Down
2 changes: 1 addition & 1 deletion bin/lxr_chunks.ml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ let () = Arg.parse argspec anon_args_fun "lxr_chunks: vxni";
let conf : configuration = {
config_nchunks = nchunks;
path_chunks = !arg_chunkpath;
path_db = "/tmp/db";
path_db = Filename.concat (Filename.get_temp_dir_name ()) "db";
my_id = myid;
trace = tracer } in
List.iter (fun cid -> Assembly.chunk_identifier_path conf !arg_aid cid |> Printf.printf "%03d %s\n" (Conversion.p2i cid))
Expand Down
2 changes: 1 addition & 1 deletion bin/lxr_distribute.ml
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ let main () = Arg.parse argspec anon_args_fun "lxr_distribute: ";
let conf : configuration = {
config_nchunks = nchunks;
path_chunks = !arg_chunkpath;
path_db = "/tmp/db";
path_db = Filename.concat (Filename.get_temp_dir_name ()) "db";
my_id = myid;
trace = tracer } in
let sinks = Yojson.Basic.from_file !arg_configpath |> from_json_sinks conf in
Expand Down
6 changes: 3 additions & 3 deletions bin/lxr_relfiles.ml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ let benchmark_run cnt =
let config : Configuration.configuration =
{ config_nchunks = Nchunks.from_int 16
; path_chunks = "lxr"
; path_db = "/tmp/db"
; path_db = Filename.concat (Filename.get_temp_dir_name ()) "db"
; my_id = "0123"
; trace = Tracer.nullTracer } in
let%lwt rel = Relfiles.new_map config in
Expand All @@ -93,7 +93,7 @@ let example_output () =
let config : Configuration.configuration =
{ config_nchunks = Nchunks.from_int 16
; path_chunks = "lxr"
; path_db = "/tmp/db"
; path_db = Filename.concat (Filename.get_temp_dir_name ()) "db"
; my_id = "4242"
; trace = Tracer.nullTracer } in
let%lwt rel = Relfiles.new_map config in
Expand Down Expand Up @@ -131,7 +131,7 @@ let example_output () =

module Config = struct
let init () = ()
let root = "/tmp/db"
let root = Filename.concat (Filename.get_temp_dir_name ()) "db"
end

open Lwt.Syntax
Expand Down
2 changes: 1 addition & 1 deletion bin/lxr_relkeys.ml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ let def_myid = "1234567890"

let arg_verbose = ref false
let arg_files = ref []
let arg_dbpath = ref "/tmp/db"
let arg_dbpath = ref (Filename.concat (Filename.get_temp_dir_name ()) "db")
let arg_myid = ref def_myid

let usage_msg = "lxr_relkeys [-v] [-i myid] [-d dbpath] <file1> [<file2>] ..."
Expand Down
4 changes: 2 additions & 2 deletions bin/lxr_restore.ml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ let def_myid = "1234567890"

let arg_verbose = ref false
let arg_files = ref []
let arg_dbpath = ref "/tmp/db"
let arg_dbpath = ref (Filename.concat (Filename.get_temp_dir_name ()) "db")
let arg_chunkpath = ref "lxr"
let arg_outpath = ref "/tmp/"
let arg_outpath = ref (Filename.get_temp_dir_name ())
let arg_nchunks = ref 16
let arg_myid = ref def_myid

Expand Down
4 changes: 2 additions & 2 deletions test/testRelkeys.ml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ let benchmark_run cnt _ () =
let config : Configuration.configuration =
{ config_nchunks = Nchunks.from_int 16
; path_chunks = "lxr"
; path_db = "/tmp/db"
; path_db = Filename.concat (Filename.get_temp_dir_name ()) "db"
; my_id = "4242"
; trace = Tracer.nullTracer } in
let%lwt rel = Relkeys.new_map config in
Expand All @@ -57,7 +57,7 @@ let example_output _ () =
let config : Configuration.configuration =
{ config_nchunks = Nchunks.from_int 16
; path_chunks = "lxr"
; path_db = "/tmp/db"
; path_db = Filename.concat (Filename.get_temp_dir_name ()) "db"
; my_id = "4242"
; trace = Tracer.nullTracer } in
let%lwt rel = Relkeys.new_map config in
Expand Down

0 comments on commit 5b45754

Please sign in to comment.