mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-05 23:09:02 +00:00
Changed: #1153 Make ryzom_client run completely in an .app bundle
This commit is contained in:
parent
fe9d8dbd8a
commit
5033d70471
4 changed files with 58 additions and 1 deletions
|
@ -231,7 +231,11 @@ void CCocoaEventEmitter::init(NL3D::IDriver* driver, CocoaOpenGLView* glView)
|
|||
bool CCocoaEventEmitter::processMessage(NSEvent* event, CEventServer* server)
|
||||
{
|
||||
if(!server && !_server)
|
||||
nlerror("no server to post events to");
|
||||
{
|
||||
// nlerror("no server to post events to");
|
||||
nldebug("no server to post events to");
|
||||
return true;
|
||||
}
|
||||
|
||||
if(!server)
|
||||
server = _server;
|
||||
|
|
|
@ -1700,6 +1700,9 @@ std::string CFileContainer::getApplicationDirectory(const std::string &appName)
|
|||
wchar_t buffer[MAX_PATH];
|
||||
SHGetSpecialFolderPathW(NULL, buffer, CSIDL_APPDATA, TRUE);
|
||||
appPath = CPath::standardizePath(ucstring((ucchar*)buffer).toUtf8());
|
||||
#elif defined(NL_OS_MAC)
|
||||
appPath = CPath::standardizePath(getenv("HOME"));
|
||||
appPath += "/Library/Preferences/";
|
||||
#else
|
||||
appPath = CPath::standardizePath(getenv("HOME"));
|
||||
#endif
|
||||
|
@ -1709,6 +1712,8 @@ std::string CFileContainer::getApplicationDirectory(const std::string &appName)
|
|||
#ifdef NL_OS_WINDOWS
|
||||
if (!appName.empty())
|
||||
path = CPath::standardizePath(path + appName);
|
||||
#elif defined(NL_OS_MAC)
|
||||
path = CPath::standardizePath(path + appName);
|
||||
#else
|
||||
if (!appName.empty())
|
||||
path = CPath::standardizePath(path + "." + toLower(appName));
|
||||
|
|
|
@ -97,6 +97,11 @@ IF(NOT APPLE AND NOT WIN32)
|
|||
TARGET_LINK_LIBRARIES(ryzom_client ${X11_LIBRARIES})
|
||||
ENDIF(NOT APPLE AND NOT WIN32)
|
||||
|
||||
IF(APPLE)
|
||||
FIND_LIBRARY(FOUNDATION_LIBRARY Foundation)
|
||||
TARGET_LINK_LIBRARIES(ryzom_client ${FOUNDATION_LIBRARY})
|
||||
ENDIF(APPLE)
|
||||
|
||||
ADD_DEFINITIONS(${LIBXML2_DEFINITIONS} ${CURL_DEFINITIONS})
|
||||
|
||||
NL_DEFAULT_PROPS(ryzom_client "Ryzom, Client: Ryzom Core Client")
|
||||
|
|
|
@ -33,6 +33,8 @@
|
|||
#ifdef NL_OS_MAC
|
||||
#include <stdio.h>
|
||||
#include <sys/resource.h>
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#include "nel/misc/dynloadlib.h"
|
||||
#endif
|
||||
|
||||
#include "nel/misc/debug.h"
|
||||
|
@ -350,6 +352,47 @@ int main(int argc, char **argv)
|
|||
// init the Nel context
|
||||
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();
|
||||
|
||||
#ifndef NL_DEBUG
|
||||
|
|
Loading…
Reference in a new issue