Skip to content

Commit

Permalink
Allow multiple bundle paths in the -load cli param.
Browse files Browse the repository at this point in the history
  • Loading branch information
dboris committed Nov 10, 2024
1 parent af17a9f commit cfd9a93
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion generate/dune
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(executable
(name main)
(public_name generate-ml)
(flags :standard -ccopt "-framework Cocoa")
(flags :standard -ccopt "-framework Foundation")
(libraries camlkit-base.runtime lib))
2 changes: 1 addition & 1 deletion generate/main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ let speclist =
; ("-super", Arg.Set include_superclass,
"Include superclass methods in generated module")
; ("-fw", Arg.Set_string fw_name, "Framework name <fw-name>")
; ("-load", Arg.Set_string load_fw, "Load framework bundle <fw-path>")
; ("-load", Arg.Set_string load_fw, "Comma-separated list of framework bundles to load")
; ("-open", Arg.Set_string open_modules,
"Comma-separated list of modules to open in generated code")
; ("-filter", Arg.Set_string filter_classes,
Expand Down
2 changes: 1 addition & 1 deletion inspect/dune
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(executable
(name main)
(public_name inspect-rt)
; (flags :standard -ccopt "-framework Cocoa")
(flags :standard -ccopt "-framework Foundation")
(libraries camlkit-base.runtime lib))
15 changes: 9 additions & 6 deletions lib/util.ml
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,15 @@ let emit_prelude ~open_modules file =

let load_framework fw =
if not (String.equal fw "") then
let bundle =
NSBundle.self |> NSBundleClass.bundleWithPath (new_string fw) in
if is_nil bundle then
Printf.eprintf "Framework bundle not found!\n%!"
else
NSBundle.load bundle |> ignore
fw
|> String.split_on_char ','
|> List.iter @@ fun fw ->
let bundle =
NSBundle.self |> NSBundleClass.bundleWithPath (new_string fw) in
if is_nil bundle then
Printf.eprintf "Framework bundle not found!\n%!"
else
NSBundle.load bundle |> ignore
;;

let class_image class_name =
Expand Down

0 comments on commit cfd9a93

Please sign in to comment.