Skip to content

Commit

Permalink
fix gobview default path
Browse files Browse the repository at this point in the history
  • Loading branch information
stilscher committed Oct 12, 2023
1 parent b373d06 commit 6302bb2
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions goblint-http-server/goblint_http.ml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ let docroot = ref "run"
let index = ref "index.html"
let addr = ref "127.0.0.1"
let port = ref 8080
let goblint = ref "goblint"
let goblint = ref "./goblint"
let file_paths = ref []
let rest = ref []

let specs =
Expand All @@ -22,8 +23,6 @@ let specs =
("-goblint", Arg.Rest_all (fun args -> rest := args), "Pass the rest of the arguments to Goblint");
]

let paths = ref []

let process state name body =
match Hashtbl.find_option Api.registry name with
| None -> Server.respond_not_found ()
Expand Down Expand Up @@ -146,7 +145,7 @@ let callback state _ req body =
| _ -> Server.respond_not_found ()

let main () =
let%lwt state = Goblint.spawn !goblint (!rest @ !paths) >|= State.make in
let%lwt state = Goblint.spawn !goblint (!rest @ !file_paths) >|= State.make in
(* run Goblint once with option gobview enabled to copy the index.html and main.js files into the served directory *)
let%lwt _ = Goblint.analyze ~save_dir:!docroot ~gobview:true state.goblint in
let callback = callback state in
Expand All @@ -155,6 +154,7 @@ let main () =

let () =
let program = Sys.argv.(0) in
let usage = Printf.sprintf "%s [-docroot DOCROOT] [-index INDEX] [-addr ADDR] [-port PORT] ... path [path ...]" program in
Arg.parse specs (fun s -> paths := s :: !paths) usage;
let usage = Printf.sprintf "Usage: %s [options] source-files\nLookup options using '%s --help'." program program in
let anon_arg a = file_paths := a :: !file_paths; () in
Arg.parse specs anon_arg usage;
Lwt_main.run (main ())

0 comments on commit 6302bb2

Please sign in to comment.