From 720c5bf3d47bbc94c06b6ba061dddf7b4e9a08d0 Mon Sep 17 00:00:00 2001 From: malc Date: Mon, 27 May 2013 00:14:20 +0400 Subject: [PATCH] Preserve some command line options when remote self executing --- main.ml | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/main.ml b/main.ml index 4c25f49..9caec02 100644 --- a/main.ml +++ b/main.ml @@ -129,6 +129,8 @@ let platform = platform ();; let now = Unix.gettimeofday;; +let selfexec = ref "";; + let popen cmd fda = if platform = Pcygwin then ( @@ -4940,7 +4942,7 @@ let gotounder = function then ( if conf.riani then - let command = Printf.sprintf "%s '%s'" Sys.argv.(0) path in + let command = !selfexec ^ " " ^ path in try popen command [] with exn -> Printf.eprintf @@ -7332,15 +7334,23 @@ let remoteopen path = let () = let trimcachepath = ref "" in let rcmdpath = ref "" in + selfexec := Sys.executable_name; Arg.parse (Arg.align [("-p", Arg.String (fun s -> state.password <- s), " Set password"); - ("-f", Arg.String (fun s -> Config.fontpath := s), + ("-f", Arg.String + (fun s -> + Config.fontpath := s; + selfexec := !selfexec ^ " -f " ^ Filename.quote s; + ), " Set path to the user interface font"); - ("-c", Arg.String (fun s -> Config.confpath := s), + ("-c", Arg.String + (fun s -> + selfexec := !selfexec ^ " -c " ^ Filename.quote s; + Config.confpath := s), " Set path to the configuration file"); ("-tcf", Arg.String (fun s -> trimcachepath := s), @@ -7369,6 +7379,9 @@ let () = (fun s -> state.path <- s) ("Usage: " ^ Sys.argv.(0) ^ " [options] some.pdf\nOptions:") ; + if !wtmode + then selfexec := !selfexec ^ " -wtmode"; + if String.length state.path = 0 then (prerr_endline "file name missing"; exit 1); -- 2.11.4.GIT