mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-12-25 18:10:54 +00:00
merge
This commit is contained in:
commit
ad89d86f86
8 changed files with 138 additions and 3 deletions
|
@ -231,7 +231,11 @@ void CCocoaEventEmitter::init(NL3D::IDriver* driver, CocoaOpenGLView* glView)
|
||||||
bool CCocoaEventEmitter::processMessage(NSEvent* event, CEventServer* server)
|
bool CCocoaEventEmitter::processMessage(NSEvent* event, CEventServer* server)
|
||||||
{
|
{
|
||||||
if(!server && !_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)
|
if(!server)
|
||||||
server = _server;
|
server = _server;
|
||||||
|
|
|
@ -1700,6 +1700,9 @@ std::string CFileContainer::getApplicationDirectory(const std::string &appName)
|
||||||
wchar_t buffer[MAX_PATH];
|
wchar_t buffer[MAX_PATH];
|
||||||
SHGetSpecialFolderPathW(NULL, buffer, CSIDL_APPDATA, TRUE);
|
SHGetSpecialFolderPathW(NULL, buffer, CSIDL_APPDATA, TRUE);
|
||||||
appPath = CPath::standardizePath(ucstring((ucchar*)buffer).toUtf8());
|
appPath = CPath::standardizePath(ucstring((ucchar*)buffer).toUtf8());
|
||||||
|
#elif defined(NL_OS_MAC)
|
||||||
|
appPath = CPath::standardizePath(getenv("HOME"));
|
||||||
|
appPath += "/Library/Application Support/";
|
||||||
#else
|
#else
|
||||||
appPath = CPath::standardizePath(getenv("HOME"));
|
appPath = CPath::standardizePath(getenv("HOME"));
|
||||||
#endif
|
#endif
|
||||||
|
@ -1709,6 +1712,8 @@ std::string CFileContainer::getApplicationDirectory(const std::string &appName)
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
if (!appName.empty())
|
if (!appName.empty())
|
||||||
path = CPath::standardizePath(path + appName);
|
path = CPath::standardizePath(path + appName);
|
||||||
|
#elif defined(NL_OS_MAC)
|
||||||
|
path = CPath::standardizePath(path + appName);
|
||||||
#else
|
#else
|
||||||
if (!appName.empty())
|
if (!appName.empty())
|
||||||
path = CPath::standardizePath(path + "." + toLower(appName));
|
path = CPath::standardizePath(path + "." + toLower(appName));
|
||||||
|
|
|
@ -97,6 +97,11 @@ IF(NOT APPLE AND NOT WIN32)
|
||||||
TARGET_LINK_LIBRARIES(ryzom_client ${X11_LIBRARIES})
|
TARGET_LINK_LIBRARIES(ryzom_client ${X11_LIBRARIES})
|
||||||
ENDIF(NOT APPLE AND NOT WIN32)
|
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})
|
ADD_DEFINITIONS(${LIBXML2_DEFINITIONS} ${CURL_DEFINITIONS})
|
||||||
|
|
||||||
NL_DEFAULT_PROPS(ryzom_client "Ryzom, Client: Ryzom Core Client")
|
NL_DEFAULT_PROPS(ryzom_client "Ryzom, Client: Ryzom Core Client")
|
||||||
|
|
65
code/ryzom/client/src/app_bundle_utils.cpp
Normal file
65
code/ryzom/client/src/app_bundle_utils.cpp
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||||
|
// Copyright (C) 2010 Winch Gate Property Limited
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU Affero General Public License as
|
||||||
|
// published by the Free Software Foundation, either version 3 of the
|
||||||
|
// License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU Affero General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#include "app_bundle_utils.h"
|
||||||
|
|
||||||
|
#if defined(NL_OS_MAC)
|
||||||
|
#include <CoreFoundation/CoreFoundation.h>
|
||||||
|
|
||||||
|
std::string getAppBundlePath()
|
||||||
|
{
|
||||||
|
static std::string cachedPathToBundle;
|
||||||
|
|
||||||
|
if(cachedPathToBundle.size())
|
||||||
|
return cachedPathToBundle;
|
||||||
|
|
||||||
|
// 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)
|
||||||
|
{
|
||||||
|
cachedPathToBundle = CFStringGetCStringPtr(
|
||||||
|
str, CFStringGetSmallestEncoding(str));
|
||||||
|
CFRelease(str);
|
||||||
|
|
||||||
|
return cachedPathToBundle;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
nlerror("CFStringGetCStringPtr");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
nlerror("CFBundleCopyBundleURL");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
nlerror("CFBundleGetMainBundle");
|
||||||
|
|
||||||
|
return std::string();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // defined(NL_OS_MAC)
|
32
code/ryzom/client/src/app_bundle_utils.h
Normal file
32
code/ryzom/client/src/app_bundle_utils.h
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||||
|
// Copyright (C) 2010 Winch Gate Property Limited
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU Affero General Public License as
|
||||||
|
// published by the Free Software Foundation, either version 3 of the
|
||||||
|
// License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU Affero General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#ifndef CL_APP_BUNDLE_UTILS_H
|
||||||
|
#define CL_APP_BUNDLE_UTILS_H 1
|
||||||
|
|
||||||
|
#include "nel/misc/types_nl.h"
|
||||||
|
|
||||||
|
#if defined(NL_OS_MAC)
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the current path to the .app bundle on Mac OS X.
|
||||||
|
* @note This path will have "Contents" as sub directory.
|
||||||
|
*/
|
||||||
|
std::string getAppBundlePath();
|
||||||
|
|
||||||
|
#endif // defined(NL_OS_MAC)
|
||||||
|
#endif // CL_APP_BUNDLE_UTILS_H
|
|
@ -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 "nel/misc/dynloadlib.h"
|
||||||
|
#include "app_bundle_utils.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "nel/misc/debug.h"
|
#include "nel/misc/debug.h"
|
||||||
|
@ -383,6 +385,9 @@ int main(int argc, char **argv)
|
||||||
getrlimit(RLIMIT_NOFILE, &rlp3);
|
getrlimit(RLIMIT_NOFILE, &rlp3);
|
||||||
nlinfo("rlimit before %d %d\n", rlp.rlim_cur, rlp.rlim_max);
|
nlinfo("rlimit before %d %d\n", rlp.rlim_cur, rlp.rlim_max);
|
||||||
nlinfo("rlimit after %d %d\n", rlp3.rlim_cur, rlp3.rlim_max);
|
nlinfo("rlimit after %d %d\n", rlp3.rlim_cur, rlp3.rlim_max);
|
||||||
|
|
||||||
|
// add the bundle's plugins path as library search path (for nel drivers)
|
||||||
|
CLibrary::addLibPath(getAppBundlePath() + "/Contents/PlugIns/nel/");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(NL_OS_WINDOWS)
|
#if defined(NL_OS_WINDOWS)
|
||||||
|
|
|
@ -45,6 +45,10 @@
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif // HAVE_CONFIG_H
|
#endif // HAVE_CONFIG_H
|
||||||
|
|
||||||
|
#ifdef NL_OS_MAC
|
||||||
|
#include "app_bundle_utils.h"
|
||||||
|
#endif // NL_OS_MAC
|
||||||
|
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
|
|
||||||
///////////
|
///////////
|
||||||
|
@ -1888,7 +1892,14 @@ void CClientConfig::init(const string &configFileName)
|
||||||
|
|
||||||
if (CFile::isExists(defaultConfigFileName)) found = true;
|
if (CFile::isExists(defaultConfigFileName)) found = true;
|
||||||
|
|
||||||
#ifdef RYZOM_ETC_PREFIX
|
#ifdef NL_OS_MAC
|
||||||
|
if (!found)
|
||||||
|
{
|
||||||
|
defaultConfigFileName =
|
||||||
|
getAppBundlePath() + "/Contents/Resources/" + defaultConfigFileName;
|
||||||
|
if(CFile::isExists(defaultConfigFileName)) found = true;
|
||||||
|
}
|
||||||
|
#elif defined(RYZOM_ETC_PREFIX)
|
||||||
if (!found)
|
if (!found)
|
||||||
{
|
{
|
||||||
defaultConfigFileName = CPath::standardizePath(RYZOM_ETC_PREFIX) + defaultConfigFileName;
|
defaultConfigFileName = CPath::standardizePath(RYZOM_ETC_PREFIX) + defaultConfigFileName;
|
||||||
|
|
|
@ -103,6 +103,10 @@ extern HINSTANCE HInstance;
|
||||||
extern HWND SlashScreen;
|
extern HWND SlashScreen;
|
||||||
#endif // NL_OS_WINDOWS
|
#endif // NL_OS_WINDOWS
|
||||||
|
|
||||||
|
#ifdef NL_OS_MAC
|
||||||
|
#include "app_bundle_utils.h"
|
||||||
|
#endif // NL_OS_MAC
|
||||||
|
|
||||||
#include <new>
|
#include <new>
|
||||||
|
|
||||||
///////////
|
///////////
|
||||||
|
@ -615,7 +619,11 @@ void addPreDataPaths(NLMISC::IProgressCallback &progress)
|
||||||
progress.progress ((float)i/(float)ClientCfg.PreDataPath.size());
|
progress.progress ((float)i/(float)ClientCfg.PreDataPath.size());
|
||||||
progress.pushCropedValues ((float)i/(float)ClientCfg.PreDataPath.size(), (float)(i+1)/(float)ClientCfg.PreDataPath.size());
|
progress.pushCropedValues ((float)i/(float)ClientCfg.PreDataPath.size(), (float)(i+1)/(float)ClientCfg.PreDataPath.size());
|
||||||
|
|
||||||
CPath::addSearchPath(ClientCfg.PreDataPath[i], true, false, &progress);
|
std::string preDataPath = ClientCfg.PreDataPath[i];
|
||||||
|
#if defined(NL_OS_MAC)
|
||||||
|
preDataPath = getAppBundlePath() + "/Contents/Resources/" + preDataPath;
|
||||||
|
#endif // defined(NL_OS_MAC)
|
||||||
|
CPath::addSearchPath(preDataPath, true, false, &progress);
|
||||||
|
|
||||||
progress.popCropedValues ();
|
progress.popCropedValues ();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue