From c76551e5a01e684c3ab727a8a1b91f134bcbc925 Mon Sep 17 00:00:00 2001 From: John Whitington Date: Mon, 24 Nov 2014 13:28:22 +0000 Subject: [PATCH] OS X Linearization fixes --- cpdf.ml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/cpdf.ml b/cpdf.ml index 15addb6..6d5ab0d 100755 --- a/cpdf.ml +++ b/cpdf.ml @@ -22,7 +22,7 @@ let call_cpdflin cpdflin temp output best_password = cpdflin ^ " --linearize " ^ " --password=" ^ best_password ^ " " ^ Filename.quote temp ^ " " ^ Filename.quote output in - print_endline command; + match Sys.os_type with "Win32" -> (* On windows, don't use LD_LIBRARY_PATH - it will happen automatically *) @@ -31,8 +31,17 @@ let call_cpdflin cpdflin temp output best_password = (* On other platforms, if -cpdflin was provided, or cpdflin was in the current folder, set up LD_LIBRARY_PATH: *) match cpdflin with - "cpdflin" -> Sys.command (cpdflin ^ " " ^ command) - | _ -> Sys.command ("LD_LIBRARY_PATH=" ^ Filename.dirname cpdflin ^ " " ^ command) + "cpdflin" -> + print_endline command; + Sys.command command + | _ -> + let command = + "DYLD_FALLBACK_LIBRARY_PATH=" ^ Filename.dirname cpdflin ^ " " ^ + "LD_LIBRARY_PATH=" ^ Filename.dirname cpdflin ^ " " ^ + command + in + print_endline command; + Sys.command command (* Recompress anything which isn't compressed, unless it's metadata. *) let recompress_stream pdf = function