mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-12-24 17:58:45 +00:00
Changed: Use defined directories prefixed by a default directory
This commit is contained in:
parent
9891de01ce
commit
b8b68c4ec1
2 changed files with 62 additions and 19 deletions
|
@ -675,22 +675,39 @@ void addSearchPaths(IProgressCallback &progress)
|
|||
progress.popCropedValues ();
|
||||
}
|
||||
|
||||
// add in last position, a specific possibly read only directory
|
||||
std::string defaultDirectory;
|
||||
|
||||
#ifdef NL_OS_MAC
|
||||
defaultDirectory = getAppBundlePath() + "/Contents/Resources/data";
|
||||
defaultDirectory = CPath::standardizePath(getAppBundlePath() + "/Contents/Resources");
|
||||
#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
|
||||
|
||||
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)
|
||||
{
|
||||
NLMISC::TTime initPaths = ryzomGetLocalTime ();
|
||||
H_AUTO(InitRZAddSearchPaths)
|
||||
|
||||
H_AUTO(InitRZAddSearchPaths);
|
||||
|
||||
for (uint i = 0; i < ClientCfg.PreDataPath.size(); i++)
|
||||
{
|
||||
progress.progress ((float)i/(float)ClientCfg.PreDataPath.size());
|
||||
|
@ -700,7 +717,34 @@ void addPreDataPaths(NLMISC::IProgressCallback &progress)
|
|||
|
||||
progress.popCropedValues ();
|
||||
}
|
||||
|
||||
//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)
|
||||
|
|
|
@ -26,6 +26,10 @@
|
|||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef NL_OS_MAC
|
||||
#include "app_bundle_utils.h"
|
||||
#endif
|
||||
|
||||
#include <memory>
|
||||
#include <errno.h>
|
||||
|
||||
|
@ -209,21 +213,16 @@ void CPatchManager::setClientRootPath(const std::string& clientRootPath)
|
|||
{
|
||||
ClientRootPath = CPath::standardizePath(clientRootPath);
|
||||
ClientPatchPath = CPath::standardizePath(ClientRootPath + "unpack");
|
||||
ReadableClientDataPath = CPath::standardizePath(ClientRootPath + "data");
|
||||
|
||||
WritableClientDataPath = CPath::standardizePath(ClientRootPath + "data");
|
||||
|
||||
std::string writableTest = ReadableClientDataPath + "writableTest";
|
||||
|
||||
// if succeeded to create a delete a temporary file in data directory
|
||||
if (CFile::createEmptyFile(writableTest) && CFile::deleteFile(writableTest))
|
||||
{
|
||||
// use it to patch data files
|
||||
WritableClientDataPath = ReadableClientDataPath;
|
||||
}
|
||||
else
|
||||
{
|
||||
// use system user profile to patch data files
|
||||
WritableClientDataPath = CPath::standardizePath(CPath::getApplicationDirectory("Ryzom") + "data");
|
||||
}
|
||||
#ifdef NL_OS_MAC
|
||||
ReadableClientDataPath = CPath::standardizePath(getAppBundlePath() + "/Contents/Resources/data");
|
||||
#elif defined(NL_OS_UNIX) && defined(RYZOM_SHARE_PREFIX)
|
||||
ReadableClientDataPath = CPath::standardizePath(std::string(RYZOM_SHARE_PREFIX) + "/data");
|
||||
#else
|
||||
ReadableClientDataPath = WritableClientDataPath;
|
||||
#endif
|
||||
}
|
||||
|
||||
// ****************************************************************************
|
||||
|
|
Loading…
Reference in a new issue