|
|
@ -33,6 +33,8 @@
|
|
|
|
#ifdef NL_OS_MAC
|
|
|
|
#ifdef NL_OS_MAC
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <sys/resource.h>
|
|
|
|
#include <sys/resource.h>
|
|
|
|
|
|
|
|
#include <CoreFoundation/CoreFoundation.h>
|
|
|
|
|
|
|
|
#include "nel/misc/dynloadlib.h"
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#include "nel/misc/debug.h"
|
|
|
|
#include "nel/misc/debug.h"
|
|
|
@ -350,6 +352,47 @@ int main(int argc, char **argv)
|
|
|
|
// init the Nel context
|
|
|
|
// init the Nel context
|
|
|
|
CApplicationContext *appContext = new CApplicationContext;
|
|
|
|
CApplicationContext *appContext = new CApplicationContext;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(NL_OS_MAC)
|
|
|
|
|
|
|
|
// get the bundle
|
|
|
|
|
|
|
|
CFBundleRef bundle = CFBundleGetMainBundle();
|
|
|
|
|
|
|
|
if(bundle)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// get the url to the bundles root
|
|
|
|
|
|
|
|
CFURLRef url = CFBundleCopyBundleURL(bundle);
|
|
|
|
|
|
|
|
if(url)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// get the file system path
|
|
|
|
|
|
|
|
CFStringRef str;
|
|
|
|
|
|
|
|
str = CFURLCopyFileSystemPath(
|
|
|
|
|
|
|
|
CFURLCopyAbsoluteURL(url), kCFURLPOSIXPathStyle);
|
|
|
|
|
|
|
|
CFRelease(url);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(str)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
std::string pathToBundle = CFStringGetCStringPtr(
|
|
|
|
|
|
|
|
str, CFStringGetSmallestEncoding(str));
|
|
|
|
|
|
|
|
CFRelease(str);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// change the working directory
|
|
|
|
|
|
|
|
nldebug("Bundle Path is %s", pathToBundle.c_str());
|
|
|
|
|
|
|
|
nldebug("setCurrentPath %s", (pathToBundle + "/Contents/Resources/").c_str());
|
|
|
|
|
|
|
|
CPath::setCurrentPath(pathToBundle + "/Contents/Resources/");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// add the search path for plugins (nel drivers)
|
|
|
|
|
|
|
|
nldebug("addLibPath %s", (pathToBundle + "/Contents/PlugIns/nel/").c_str());
|
|
|
|
|
|
|
|
CLibrary::addLibPath(pathToBundle + "/Contents/PlugIns/nel/");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
nlerror("CFStringGetCStringPtr");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
nlerror("CFBundleCopyBundleURL");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
nlerror("CFBundleGetMainBundle");
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
createDebug();
|
|
|
|
createDebug();
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef NL_DEBUG
|
|
|
|
#ifndef NL_DEBUG
|
|
|
|