1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69

#include "fsCResourceNamePathAdjuster.h"

#include <platform/CCFileUtils.h>

#include <fsCore/src/fsCAppSettings.h>
#include <fsCore/fsIHardware.h>
#include <fsCore/fsIFile.h>

//#if defined fsPlayStore
//	#include <fsCommerce/impl/marmalade/google/fsCExpansionFile.h>
//#endif


void fsCResourceNamePathAdjuster::savedDataFolderCreateDo() const
{
	fsIFile::systemFolderCreate(savedDataFullFolderPathGet());
}

fsStr fsCResourceNamePathAdjuster::savedDataFullFolderPathGet() const<--- The member function 'fsCResourceNamePathAdjuster::savedDataFullFolderPathGet' can be static.
{
	return mHardware->appDataFolderGet() + savedDataFolderGet();
}

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); //coocos2d-x handles windows paths
}

void fsCResourceNamePathAdjuster::searchPathSet()<--- The member function 'fsCResourceNamePathAdjuster::searchPathSet' can be static.
{
	std::vector<std::string> searchPaths = cocos2d::FileUtils::getInstance()->getSearchPaths();
	std::string pth = searchPaths.back();
	pth.replace(pth.find("Resources"), std::string("Resources").length(), std::string("assets"));
	searchPaths.clear();
	searchPaths.push_back(pth);
	cocos2d::FileUtils::getInstance()->setSearchPaths(searchPaths);
}


fsCResourceNamePathAdjuster::fsCResourceNamePathAdjuster()
{
#if defined fsPCStore && !defined fsRELEASE
	searchPathSet();
#endif
}

fsCResourceNamePathAdjuster::~fsCResourceNamePathAdjuster()
{
}