mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-10 09:19:01 +00:00
Changed: Use defined directories prefixed by a default directory
This commit is contained in:
parent
b9962b01c9
commit
80da14b2d6
2 changed files with 62 additions and 19 deletions
|
@ -675,22 +675,39 @@ void addSearchPaths(IProgressCallback &progress)
|
||||||
progress.popCropedValues ();
|
progress.popCropedValues ();
|
||||||
}
|
}
|
||||||
|
|
||||||
// add in last position, a specific possibly read only directory
|
|
||||||
std::string defaultDirectory;
|
std::string defaultDirectory;
|
||||||
|
|
||||||
#ifdef NL_OS_MAC
|
#ifdef NL_OS_MAC
|
||||||
defaultDirectory = getAppBundlePath() + "/Contents/Resources/data";
|
defaultDirectory = CPath::standardizePath(getAppBundlePath() + "/Contents/Resources");
|
||||||
#elif defined(NL_OS_UNIX) && defined(RYZOM_SHARE_PREFIX)
|
#elif defined(NL_OS_UNIX) && defined(RYZOM_SHARE_PREFIX)
|
||||||
defaultDirectory = std::string(RYZOM_SHARE_PREFIX) + "/data";
|
defaultDirectory = CPath::standardizePath(std::string(RYZOM_SHARE_PREFIX));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!defaultDirectory.empty()) CPath::addSearchPath(defaultDirectory, true, false);
|
// add in last position, a specific possibly read only directory
|
||||||
|
if (!defaultDirectory.empty())
|
||||||
|
{
|
||||||
|
for (uint i = 0; i < ClientCfg.DataPath.size(); i++)
|
||||||
|
{
|
||||||
|
// don't prepend default directory if path is absolute
|
||||||
|
if (!ClientCfg.PreDataPath[i].empty() && ClientCfg.PreDataPath[i][0] != '/')
|
||||||
|
{
|
||||||
|
progress.progress ((float)i/(float)ClientCfg.DataPath.size());
|
||||||
|
progress.pushCropedValues ((float)i/(float)ClientCfg.DataPath.size(), (float)(i+1)/(float)ClientCfg.DataPath.size());
|
||||||
|
|
||||||
|
CPath::addSearchPath(defaultDirectory + ClientCfg.DataPath[i], true, false, &progress);
|
||||||
|
|
||||||
|
progress.popCropedValues ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void addPreDataPaths(NLMISC::IProgressCallback &progress)
|
void addPreDataPaths(NLMISC::IProgressCallback &progress)
|
||||||
{
|
{
|
||||||
NLMISC::TTime initPaths = ryzomGetLocalTime ();
|
NLMISC::TTime initPaths = ryzomGetLocalTime ();
|
||||||
H_AUTO(InitRZAddSearchPaths)
|
|
||||||
|
H_AUTO(InitRZAddSearchPaths);
|
||||||
|
|
||||||
for (uint i = 0; i < ClientCfg.PreDataPath.size(); i++)
|
for (uint i = 0; i < ClientCfg.PreDataPath.size(); i++)
|
||||||
{
|
{
|
||||||
progress.progress ((float)i/(float)ClientCfg.PreDataPath.size());
|
progress.progress ((float)i/(float)ClientCfg.PreDataPath.size());
|
||||||
|
@ -700,7 +717,34 @@ void addPreDataPaths(NLMISC::IProgressCallback &progress)
|
||||||
|
|
||||||
progress.popCropedValues ();
|
progress.popCropedValues ();
|
||||||
}
|
}
|
||||||
|
|
||||||
//nlinfo ("PROFILE: %d seconds for Add search paths Predata", (uint32)(ryzomGetLocalTime ()-initPaths)/1000);
|
//nlinfo ("PROFILE: %d seconds for Add search paths Predata", (uint32)(ryzomGetLocalTime ()-initPaths)/1000);
|
||||||
|
|
||||||
|
std::string defaultDirectory;
|
||||||
|
|
||||||
|
#ifdef NL_OS_MAC
|
||||||
|
defaultDirectory = CPath::standardizePath(getAppBundlePath() + "/Contents/Resources");
|
||||||
|
#elif defined(NL_OS_UNIX) && defined(RYZOM_SHARE_PREFIX)
|
||||||
|
defaultDirectory = CPath::standardizePath(std::string(RYZOM_SHARE_PREFIX));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// add in last position, a specific possibly read only directory
|
||||||
|
if (!defaultDirectory.empty())
|
||||||
|
{
|
||||||
|
for (uint i = 0; i < ClientCfg.PreDataPath.size(); i++)
|
||||||
|
{
|
||||||
|
// don't prepend default directory if path is absolute
|
||||||
|
if (!ClientCfg.PreDataPath[i].empty() && ClientCfg.PreDataPath[i][0] != '/')
|
||||||
|
{
|
||||||
|
progress.progress ((float)i/(float)ClientCfg.PreDataPath.size());
|
||||||
|
progress.pushCropedValues ((float)i/(float)ClientCfg.PreDataPath.size(), (float)(i+1)/(float)ClientCfg.PreDataPath.size());
|
||||||
|
|
||||||
|
CPath::addSearchPath(defaultDirectory + ClientCfg.PreDataPath[i], true, false, &progress);
|
||||||
|
|
||||||
|
progress.popCropedValues ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void addPackedSheetUpdatePaths(NLMISC::IProgressCallback &progress)
|
static void addPackedSheetUpdatePaths(NLMISC::IProgressCallback &progress)
|
||||||
|
|
|
@ -26,6 +26,10 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef NL_OS_MAC
|
||||||
|
#include "app_bundle_utils.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
@ -209,21 +213,16 @@ void CPatchManager::setClientRootPath(const std::string& clientRootPath)
|
||||||
{
|
{
|
||||||
ClientRootPath = CPath::standardizePath(clientRootPath);
|
ClientRootPath = CPath::standardizePath(clientRootPath);
|
||||||
ClientPatchPath = CPath::standardizePath(ClientRootPath + "unpack");
|
ClientPatchPath = CPath::standardizePath(ClientRootPath + "unpack");
|
||||||
ReadableClientDataPath = CPath::standardizePath(ClientRootPath + "data");
|
|
||||||
|
|
||||||
std::string writableTest = ReadableClientDataPath + "writableTest";
|
WritableClientDataPath = CPath::standardizePath(ClientRootPath + "data");
|
||||||
|
|
||||||
// if succeeded to create a delete a temporary file in data directory
|
#ifdef NL_OS_MAC
|
||||||
if (CFile::createEmptyFile(writableTest) && CFile::deleteFile(writableTest))
|
ReadableClientDataPath = CPath::standardizePath(getAppBundlePath() + "/Contents/Resources/data");
|
||||||
{
|
#elif defined(NL_OS_UNIX) && defined(RYZOM_SHARE_PREFIX)
|
||||||
// use it to patch data files
|
ReadableClientDataPath = CPath::standardizePath(std::string(RYZOM_SHARE_PREFIX) + "/data");
|
||||||
WritableClientDataPath = ReadableClientDataPath;
|
#else
|
||||||
}
|
ReadableClientDataPath = WritableClientDataPath;
|
||||||
else
|
#endif
|
||||||
{
|
|
||||||
// use system user profile to patch data files
|
|
||||||
WritableClientDataPath = CPath::standardizePath(CPath::getApplicationDirectory("Ryzom") + "data");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ****************************************************************************
|
// ****************************************************************************
|
||||||
|
|
Loading…
Reference in a new issue