textscreen: Simplify AppleScript for fileselect.

Since macOS 10.9 it is no longer to "tell an application" in order
to display pop-up UI elements like the file select dialogs. Quote:

> osascript(1) is now a “UI element” process and can therefore display
> its own UI, such as using display dialog; telling another application
> such as System Events is no longer necessary. [12365409]

As well as simplifying the wrapper this also fixes some issues with the
pop-up dialogs where window focus was getting messed up after selecting
a file.
This commit is contained in:
Simon Howard 2018-03-16 23:41:44 -04:00
parent dd45fd9652
commit 1db716fa17

View file

@ -331,13 +331,7 @@ char *TXT_SelectFile(char *window_title, char **extensions)
// an Objective C dependency. This is rather silly.
// Printf format string for the "wrapper" portion of the AppleScript:
#define APPLESCRIPT_WRAPPER \
"tell application (path to frontmost application as text)\n" \
" activate\n" \
" set theFile to (%s)\n" \
" copy POSIX path of theFile to stdout\n" \
"end tell\n"
#define APPLESCRIPT_WRAPPER "copy POSIX path of (%s) to stdout"
static char *EscapedString(char *s)
{