aboutsummaryrefslogtreecommitdiff
path: root/core/init.lua
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2008-10-27 03:44:14 -0400
committermitchell <70453897+667e-11@users.noreply.github.com>2008-10-27 03:44:14 -0400
commita87d7403532c3a2be43e158e0cf3dd1e8e82f7ab (patch)
treefd710e6ba5286026f26a6a4e69dfd84dcc109f1f /core/init.lua
parent99c71445d4892fb8d465dc33767ac2fbc769ec50 (diff)
downloadtextadept-a87d7403532c3a2be43e158e0cf3dd1e8e82f7ab.tar.gz
textadept-a87d7403532c3a2be43e158e0cf3dd1e8e82f7ab.zip
Updated Textadept to compile and run on OSX with native GTK framework.
Diffstat (limited to 'core/init.lua')
-rw-r--r--core/init.lua25
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