mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
Make "open -a" implicit on macOS
Fix for bug #12570 - add simple check for app bundle name and prefix it with macOS open command if name matches
This commit is contained in:
parent
00f371e43e
commit
a89f2fd08c
@ -217,6 +217,21 @@ string const parsecmd(string const & incmd, string & infile, string & outfile,
|
||||
}
|
||||
} else if (c == '<' && !(in_double_quote || escaped)) {
|
||||
o = 3;
|
||||
#if defined (USE_MACOSX_PACKAGING)
|
||||
} else if (o == 0 && i > 4 && c == ' ' && !(in_double_quote || escaped)) {
|
||||
// if a macOS app is detected with an additional argument
|
||||
// use open command as prefix to get it work
|
||||
const size_t apos = outcmd[o].rfind(".app");
|
||||
const size_t len = outcmd[o].length();
|
||||
const bool quoted = outcmd[o].at(len - 1) == '"' && outcmd[o].at(0) == '"';
|
||||
const string & ocmd = "open -a ";
|
||||
if (apos != string::npos &&
|
||||
(apos == (len - 4) || (apos == (len - 5) && quoted)) &&
|
||||
!prefixIs(trim(outcmd[o]), ocmd)) {
|
||||
outcmd[o] = ocmd + outcmd[o];
|
||||
}
|
||||
outcmd[o] += c;
|
||||
#endif
|
||||
} else {
|
||||
if (escaped && in_double_quote)
|
||||
outcmd[o] += '\\';
|
||||
|
Loading…
Reference in New Issue
Block a user