8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-24 01:23:03 +01:00

Fix embedded on MacOS issue with symbolic links and relative paths

This commit is contained in:
paulbeach 2013-11-07 11:10:54 +00:00
parent c4bdb8f689
commit 5377f3200d

View File

@ -41,6 +41,7 @@
#include <CoreFoundation/CFBundle.h>
#include <CoreFoundation/CFURL.h>
#include <mach-o/dyld.h>
#include <stdlib.h>
typedef Firebird::PathName string;
@ -79,7 +80,10 @@ static string getExecutablePath()
char file_buff[MAXPATHLEN];
uint32_t bufsize = sizeof(file_buff);
_NSGetExecutablePath(file_buff, &bufsize);
string bin_dir = file_buff;
char canonic[PATH_MAX];
if (!realpath(file_buff, canonic))
Firebird::system_call_failed::raise("realpath");
string bin_dir = canonic;
// get rid of the filename
int index = bin_dir.rfind(PathUtils::dir_sep);
bin_dir = bin_dir.substr(0, index);