mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-15 14:08:42 +00:00
Fixed: Open web pages in background under OS X and don't close client
This commit is contained in:
parent
251c379540
commit
cc7ee55b9c
1 changed files with 22 additions and 1 deletions
|
@ -23,6 +23,8 @@
|
||||||
# include <ShellAPI.h>
|
# include <ShellAPI.h>
|
||||||
# include <io.h>
|
# include <io.h>
|
||||||
# include <tchar.h>
|
# include <tchar.h>
|
||||||
|
#elif defined NL_OS_MAC
|
||||||
|
# include <ApplicationServices/ApplicationServices.h>
|
||||||
#elif defined NL_OS_UNIX
|
#elif defined NL_OS_UNIX
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
# include <cerrno>
|
# include <cerrno>
|
||||||
|
@ -1091,7 +1093,26 @@ static bool openDocWithExtension (const char *document, const char *ext)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#elif defined(NL_OS_MAC)
|
#elif defined(NL_OS_MAC)
|
||||||
return launchProgram("open", document);
|
CFURLRef url = CFURLCreateWithBytes(NULL, (const UInt8 *)document, strlen(document), kCFStringEncodingUTF8, NULL);
|
||||||
|
|
||||||
|
if (url)
|
||||||
|
{
|
||||||
|
OSStatus res = LSOpenCFURLRef(url, 0);
|
||||||
|
CFRelease(url);
|
||||||
|
|
||||||
|
if (res != 0)
|
||||||
|
{
|
||||||
|
nlwarning("LSOpenCFURLRef %s returned %d", document, (sint)res);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nlwarning("Unable to create URL from %s", document);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
std::string command = "/usr/bin/xdg-open";
|
std::string command = "/usr/bin/xdg-open";
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue