#include "fsCResourceNamePathAdjuster.h"
#include <platform/FileUtils.h>
#include <fsCore/src/fsCAppSettings.h>
#include <fsCore/fsIHardware.h>
#include <fsCore/fsIFile.h>
#include <fsCore/fsBaseTypes.h>
void fsCResourceNamePathAdjuster::savedDataFolderCreateDo() const
{
fsIFile::systemFolderCreate(savedDataFullFolderPathGet());
}
fsStr fsCResourceNamePathAdjuster::savedDataFullFolderPathGet() const<--- The member function 'fsCResourceNamePathAdjuster::savedDataFullFolderPathGet' can be static.
{
return mHardware->appDataFolderGet() + savedDataFolderGet();
// return mHardware->appDataFolderGet() + fsIResourceNamePathAdjuster::mPathSeparator + "savedData" + fsIResourceNamePathAdjuster::mPathSeparator;
}
void fsCResourceNamePathAdjuster::savedDataPathAdjustDo(fsStr& pPath,
fsCResourceName::eResourceLocation pLocation) const
{
if (pLocation == fsCResourceName::eRES_LOCATION_USER_SETTINGS)
{
pPath = savedDataFullFolderPathGet() + pPath;
}
}
void fsCResourceNamePathAdjuster::audioExtensionAdjustDo(fsStr& pPath,
fsCResourceName::eResourceLocation pLocation) const
{
if (fsStr::npos != pPath.rfind(".wav"))
{
pPath.eraseFromLast(".");
pPath += ".mp3";
}
}
void fsCResourceNamePathAdjuster::pathAdjustDo(fsStr& pPath, fsCResourceName::eResourceLocation pLocation) const
{
pPath.replaceAll("\\", mPathSeparator);
}
void fsCResourceNamePathAdjuster::searchPathSet()<--- The member function 'fsCResourceNamePathAdjuster::searchPathSet' can be static.
{
std::vector<std::string> searchPaths = axmol::FileUtils::getInstance()->getSearchPaths();
fsBool contentFound = false;
for (auto& pth : searchPaths)
{
if(pth.find("Content") != std::string::npos)
{
contentFound = true;
pth.replace(pth.find("Content"), std::string("Content").length(), std::string("assets"));
}
}
if (!contentFound)
{
auto pth = searchPaths.front();
pth.append("assets/");
searchPaths.push_back(pth);
}
axmol::FileUtils::getInstance()->setSearchPaths(searchPaths);
}
fsCResourceNamePathAdjuster::fsCResourceNamePathAdjuster()
{
#if defined fsPCStore && !defined fsRELEASE
searchPathSet();
#endif
}
fsCResourceNamePathAdjuster::~fsCResourceNamePathAdjuster()
{
}