From a87d7403532c3a2be43e158e0cf3dd1e8e82f7ab Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Mon, 27 Oct 2008 03:44:14 -0400 Subject: Updated Textadept to compile and run on OSX with native GTK framework. --- core/init.lua | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'core/init.lua') 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 -- cgit v1.2.3