changeset 20961:f55251db0833

Add support for the Mac OS X "open" command. * libinterp/corefcn/sysdep.cc (__open_with_system_app__): Use "open" instead of "xdg-open" to open files on Mac OS X.
author Ben Abbott <bpabbott@mac.com>
date Tue, 22 Dec 2015 07:43:44 -0500
parents 2a99b8b250cd
children 3aa293be0e8d
files libinterp/corefcn/sysdep.cc
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/sysdep.cc	Tue Dec 22 01:34:05 2015 +0100
+++ b/libinterp/corefcn/sysdep.cc	Tue Dec 22 07:43:44 2015 -0500
@@ -204,6 +204,13 @@
 
   // ShellExecute returns a value greater than 32 if successful.
   retval = (reinterpret_cast<ptrdiff_t> (status) > 32);
+#elif defined (__APPLE__)
+  octave_value_list tmp
+    = Fsystem (ovl ("open " + file + " 2> /dev/null",
+                    false, "async"),
+               1);
+
+  retval = (tmp(0).double_value () == 0);
 #else
   octave_value_list tmp
     = Fsystem (ovl ("xdg-open " + file + " 2> /dev/null",