diff options
Diffstat (limited to 'core/init.lua')
-rw-r--r-- | core/init.lua | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/core/init.lua b/core/init.lua index 6b491583..84c0d4d6 100644 --- a/core/init.lua +++ b/core/init.lua @@ -11,7 +11,9 @@ _THEME = '' require 'iface' require 'events' require 'file_io' -require 'lua_dialog' +if not MAC then + require 'lua_dialog' +end --- -- Checks if the buffer being indexed is the currently focused buffer. @@ -36,10 +38,23 @@ end -- used. -- @return string CocoaDialog result. function cocoa_dialog(kind, opts) - local args = { kind } + local args = not MAC and { kind } or '' for k, v in pairs(opts) do - args[#args + 1] = '--'..k - if type(v) == 'string' then args[#args + 1] = v end + if not MAC then + args[#args + 1] = '--'..k + if type(v) == 'string' then args[#args + 1] = v end + else + args = args..' --'..k + if type(v) == 'string' then args = args..' "'..v..'"' end + end + end + if not MAC then + return lua_dialog.run(args) + else + local cocoa_dialog = '/CocoaDialog.app/Contents/MacOS/CocoaDialog ' + local p = io.popen(_HOME..cocoa_dialog..kind..args) + local out = p:read('*all') + p:close() + return out end - return lua_dialog.run(args) end |