mirror of https://github.com/KLayout/klayout.git
Added method to derive application path for MacOS (/proc isn't there on MacOS)
This commit is contained in:
parent
48a6b4b57a
commit
b7a18b3278
|
|
@ -30,6 +30,9 @@
|
|||
|
||||
#ifdef _WIN32
|
||||
# include <windows.h>
|
||||
#elif __APPLE__
|
||||
# include <libproc.h>
|
||||
# include <unistd.h>
|
||||
#else
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
|
@ -79,6 +82,15 @@ get_inst_path_internal ()
|
|||
return tl::to_string (fi.absolutePath ());
|
||||
}
|
||||
|
||||
#elif __APPLE__
|
||||
|
||||
char buffer[PROC_PIDPATHINFO_MAXSIZE];
|
||||
int ret = proc_pidpath (getpid (), buffer, sizeof (buffer));
|
||||
if (ret > 0) {
|
||||
// TODO: does this correctly translate paths? (MacOS uses UTF-8 encoding with D-like normalization)
|
||||
return tl::to_string (QFileInfo (QString::fromUtf8 (buffer)).absolutePath ());
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
QFileInfo proc_exe (tl::to_qstring (tl::sprintf ("/proc/%d/exe", getpid ())));
|
||||
|
|
|
|||
Loading…
Reference in New Issue