mirror of https://github.com/axmolengine/axmol.git
Merge pull request #1916 from dumganhar/master
CCFileUtils::s|gSearchPath -> CCFileUtils::s|gSearchPaths.
This commit is contained in:
commit
db61976a71
|
@ -177,7 +177,7 @@ public:
|
||||||
/**
|
/**
|
||||||
@brief Set the resource directory; we will find resources relative to this directory.
|
@brief Set the resource directory; we will find resources relative to this directory.
|
||||||
@param pszDirectoryName Relative path to root.
|
@param pszDirectoryName Relative path to root.
|
||||||
@deprecated Please use setSearchPath instead.
|
@deprecated Please use setSearchPaths instead.
|
||||||
*/
|
*/
|
||||||
CC_DEPRECATED_ATTRIBUTE void setResourceDirectory(const char *pszDirectoryName);
|
CC_DEPRECATED_ATTRIBUTE void setResourceDirectory(const char *pszDirectoryName);
|
||||||
|
|
||||||
|
@ -206,17 +206,17 @@ public:
|
||||||
* @param searchPaths
|
* @param searchPaths
|
||||||
* @since v2.1
|
* @since v2.1
|
||||||
*/
|
*/
|
||||||
void setSearchPath(const std::vector<std::string>& searchPaths);
|
void setSearchPaths(const std::vector<std::string>& searchPaths);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the array of search paths.
|
* Gets the array of search paths.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
const std::vector<std::string>& getSearchPath();
|
const std::vector<std::string>& getSearchPaths();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the resource directory
|
* Gets the resource directory
|
||||||
* @deprecated Please use getSearchPath() instead.
|
* @deprecated Please use getSearchPaths() instead.
|
||||||
*/
|
*/
|
||||||
CC_DEPRECATED_ATTRIBUTE const char* getResourceDirectory();
|
CC_DEPRECATED_ATTRIBUTE const char* getResourceDirectory();
|
||||||
|
|
||||||
|
|
|
@ -410,7 +410,7 @@ const std::vector<std::string>& CCFileUtils::getSearchResolutionsOrder()
|
||||||
return m_searchResolutionsOrderArray;
|
return m_searchResolutionsOrderArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<std::string>& CCFileUtils::getSearchPath()
|
const std::vector<std::string>& CCFileUtils::getSearchPaths()
|
||||||
{
|
{
|
||||||
return m_searchPathArray;
|
return m_searchPathArray;
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,7 +92,7 @@ std::string CCFileUtils::fullPathForFilename(const char* pszFileName)
|
||||||
// 2) Files not in APK, e.g. /data/data/org.cocos2dx.hellocpp/cache/path/path/file.png, or /sdcard/path/path/file.png.
|
// 2) Files not in APK, e.g. /data/data/org.cocos2dx.hellocpp/cache/path/path/file.png, or /sdcard/path/path/file.png.
|
||||||
// So these two situations need to be checked on Android.
|
// So these two situations need to be checked on Android.
|
||||||
std::string strFileName = pszFileName;
|
std::string strFileName = pszFileName;
|
||||||
if (pszFileName[0] == '/' || strFileName.find("assets/") == 0)
|
if (pszFileName[0] == '/' || strFileName.find(m_strDefaultResRootPath) == 0)
|
||||||
{
|
{
|
||||||
CCLOG("Return absolute path( %s ) directly.", pszFileName);
|
CCLOG("Return absolute path( %s ) directly.", pszFileName);
|
||||||
return pszFileName;
|
return pszFileName;
|
||||||
|
@ -241,12 +241,12 @@ void CCFileUtils::setResourceDirectory(const char* pszResourceDirectory)
|
||||||
{
|
{
|
||||||
if (pszResourceDirectory == NULL) return;
|
if (pszResourceDirectory == NULL) return;
|
||||||
m_obDirectory = pszResourceDirectory;
|
m_obDirectory = pszResourceDirectory;
|
||||||
std::vector<std::string> searchPaths = this->getSearchPath();;
|
std::vector<std::string> searchPaths = this->getSearchPaths();;
|
||||||
searchPaths.insert(searchPaths.begin(), pszResourceDirectory);
|
searchPaths.insert(searchPaths.begin(), pszResourceDirectory);
|
||||||
this->setSearchPath(searchPaths);
|
this->setSearchPaths(searchPaths);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCFileUtils::setSearchPath(const std::vector<std::string>& searchPaths)
|
void CCFileUtils::setSearchPaths(const std::vector<std::string>& searchPaths)
|
||||||
{
|
{
|
||||||
bool bExistDefaultRootPath = false;
|
bool bExistDefaultRootPath = false;
|
||||||
|
|
||||||
|
|
|
@ -88,9 +88,9 @@ void CCApplication::setResourceRootPath(const std::string& rootResDir)
|
||||||
m_resourceRootPath += '/';
|
m_resourceRootPath += '/';
|
||||||
}
|
}
|
||||||
CCFileUtils* pFileUtils = CCFileUtils::sharedFileUtils();
|
CCFileUtils* pFileUtils = CCFileUtils::sharedFileUtils();
|
||||||
std::vector<std::string> searchPaths = pFileUtils->getSearchPath();
|
std::vector<std::string> searchPaths = pFileUtils->getSearchPaths();
|
||||||
searchPaths.insert(searchPaths.begin(), m_resourceRootPath);
|
searchPaths.insert(searchPaths.begin(), m_resourceRootPath);
|
||||||
pFileUtils->setSearchPath(searchPaths);
|
pFileUtils->setSearchPaths(searchPaths);
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string& CCApplication::getResourceRootPath(void)
|
const std::string& CCApplication::getResourceRootPath(void)
|
||||||
|
|
|
@ -65,13 +65,13 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the Resource root path.
|
* Sets the Resource root path.
|
||||||
* @deprecated Please use CCFileUtils::sharedFileUtils()->setSearchPath() instead.
|
* @deprecated Please use CCFileUtils::sharedFileUtils()->setSearchPaths() instead.
|
||||||
*/
|
*/
|
||||||
CC_DEPRECATED_ATTRIBUTE void setResourceRootPath(const std::string& rootResDir);
|
CC_DEPRECATED_ATTRIBUTE void setResourceRootPath(const std::string& rootResDir);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the Resource root path.
|
* Gets the Resource root path.
|
||||||
* @deprecated Please use CCFileUtils::sharedFileUtils()->getSearchPath() instead.
|
* @deprecated Please use CCFileUtils::sharedFileUtils()->getSearchPaths() instead.
|
||||||
*/
|
*/
|
||||||
CC_DEPRECATED_ATTRIBUTE const std::string& getResourceRootPath(void);
|
CC_DEPRECATED_ATTRIBUTE const std::string& getResourceRootPath(void);
|
||||||
|
|
||||||
|
|
|
@ -104,8 +104,9 @@ std::string CCFileUtils::fullPathForFilename(const char* pszFileName)
|
||||||
CCAssert(pszFileName != NULL, "CCFileUtils: Invalid path");
|
CCAssert(pszFileName != NULL, "CCFileUtils: Invalid path");
|
||||||
|
|
||||||
// Return directly if it's absolute path.
|
// Return directly if it's absolute path.
|
||||||
if (pszFileName[0] == '/')
|
if (pszFileName[0] == '/' || strFileName.find(m_strDefaultResRootPath) == 0)
|
||||||
{
|
{
|
||||||
|
CCLOG("Return absolute path( %s ) directly.", pszFileName);
|
||||||
return pszFileName;
|
return pszFileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,12 +205,12 @@ void CCFileUtils::setResourceDirectory(const char* pszResourceDirectory)
|
||||||
{
|
{
|
||||||
if (pszResourceDirectory == NULL) return;
|
if (pszResourceDirectory == NULL) return;
|
||||||
m_obDirectory = pszResourceDirectory;
|
m_obDirectory = pszResourceDirectory;
|
||||||
std::vector<std::string> searchPaths = this->getSearchPath();;
|
std::vector<std::string> searchPaths = this->getSearchPaths();;
|
||||||
searchPaths.insert(searchPaths.begin(), pszResourceDirectory);
|
searchPaths.insert(searchPaths.begin(), pszResourceDirectory);
|
||||||
this->setSearchPath(searchPaths);
|
this->setSearchPaths(searchPaths);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCFileUtils::setSearchPath(const std::vector<std::string>& searchPaths)
|
void CCFileUtils::setSearchPaths(const std::vector<std::string>& searchPaths)
|
||||||
{
|
{
|
||||||
bool bExistDefaultRootPath = false;
|
bool bExistDefaultRootPath = false;
|
||||||
|
|
||||||
|
|
|
@ -205,7 +205,7 @@ const std::vector<std::string>& CCFileUtils::getSearchResolutionsOrder()
|
||||||
return m_searchResolutionsOrderArray;
|
return m_searchResolutionsOrderArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCFileUtils::setSearchPath(const std::vector<std::string>& searchPaths)
|
void CCFileUtils::setSearchPaths(const std::vector<std::string>& searchPaths)
|
||||||
{
|
{
|
||||||
bool bExistDefault = false;
|
bool bExistDefault = false;
|
||||||
m_searchPathArray.clear();
|
m_searchPathArray.clear();
|
||||||
|
@ -223,7 +223,7 @@ void CCFileUtils::setSearchPath(const std::vector<std::string>& searchPaths)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<std::string>& CCFileUtils::getSearchPath()
|
const std::vector<std::string>& CCFileUtils::getSearchPaths()
|
||||||
{
|
{
|
||||||
return m_searchPathArray;
|
return m_searchPathArray;
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,9 +74,9 @@ void CCApplication::setResourceRootPath(const std::string& rootResDir)
|
||||||
m_resourceRootPath += '/';
|
m_resourceRootPath += '/';
|
||||||
}
|
}
|
||||||
CCFileUtils* pFileUtils = CCFileUtils::sharedFileUtils();
|
CCFileUtils* pFileUtils = CCFileUtils::sharedFileUtils();
|
||||||
std::vector<std::string> searchPaths = pFileUtils->getSearchPath();
|
std::vector<std::string> searchPaths = pFileUtils->getSearchPaths();
|
||||||
searchPaths.insert(searchPaths.begin(), m_resourceRootPath);
|
searchPaths.insert(searchPaths.begin(), m_resourceRootPath);
|
||||||
pFileUtils->setSearchPath(searchPaths);
|
pFileUtils->setSearchPaths(searchPaths);
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string& CCApplication::getResourceRootPath(void)
|
const std::string& CCApplication::getResourceRootPath(void)
|
||||||
|
|
|
@ -43,13 +43,13 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the Resource root path.
|
* Sets the Resource root path.
|
||||||
* @deprecated Please use CCFileUtils::sharedFileUtils()->setSearchPath() instead.
|
* @deprecated Please use CCFileUtils::sharedFileUtils()->setSearchPaths() instead.
|
||||||
*/
|
*/
|
||||||
CC_DEPRECATED_ATTRIBUTE void setResourceRootPath(const std::string& rootResDir);
|
CC_DEPRECATED_ATTRIBUTE void setResourceRootPath(const std::string& rootResDir);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the Resource root path.
|
* Gets the Resource root path.
|
||||||
* @deprecated Please use CCFileUtils::sharedFileUtils()->getSearchPath() instead.
|
* @deprecated Please use CCFileUtils::sharedFileUtils()->getSearchPaths() instead.
|
||||||
*/
|
*/
|
||||||
CC_DEPRECATED_ATTRIBUTE const std::string& getResourceRootPath(void);
|
CC_DEPRECATED_ATTRIBUTE const std::string& getResourceRootPath(void);
|
||||||
|
|
||||||
|
|
|
@ -199,12 +199,12 @@ void CCFileUtils::setResourceDirectory(const char* pszResourceDirectory)
|
||||||
{
|
{
|
||||||
if (pszResourceDirectory == NULL) return;
|
if (pszResourceDirectory == NULL) return;
|
||||||
m_obDirectory = pszResourceDirectory;
|
m_obDirectory = pszResourceDirectory;
|
||||||
std::vector<std::string> searchPaths = this->getSearchPath();;
|
std::vector<std::string> searchPaths = this->getSearchPaths();;
|
||||||
searchPaths.insert(searchPaths.begin(), pszResourceDirectory);
|
searchPaths.insert(searchPaths.begin(), pszResourceDirectory);
|
||||||
this->setSearchPath(searchPaths);
|
this->setSearchPaths(searchPaths);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCFileUtils::setSearchPath(const std::vector<std::string>& searchPaths)
|
void CCFileUtils::setSearchPaths(const std::vector<std::string>& searchPaths)
|
||||||
{
|
{
|
||||||
bool bExistDefaultRootPath = false;
|
bool bExistDefaultRootPath = false;
|
||||||
|
|
||||||
|
|
|
@ -71,13 +71,13 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the Resource root path.
|
* Sets the Resource root path.
|
||||||
* @deprecated Please use CCFileUtils::sharedFileUtils()->setSearchPath() instead.
|
* @deprecated Please use CCFileUtils::sharedFileUtils()->setSearchPaths() instead.
|
||||||
*/
|
*/
|
||||||
CC_DEPRECATED_ATTRIBUTE void setResourceRootPath(const std::string& rootResDir);
|
CC_DEPRECATED_ATTRIBUTE void setResourceRootPath(const std::string& rootResDir);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the Resource root path.
|
* Gets the Resource root path.
|
||||||
* @deprecated Please use CCFileUtils::sharedFileUtils()->getSearchPath() instead.
|
* @deprecated Please use CCFileUtils::sharedFileUtils()->getSearchPaths() instead.
|
||||||
*/
|
*/
|
||||||
CC_DEPRECATED_ATTRIBUTE const std::string& getResourceRootPath(void);
|
CC_DEPRECATED_ATTRIBUTE const std::string& getResourceRootPath(void);
|
||||||
|
|
||||||
|
|
|
@ -131,9 +131,9 @@ void CCApplication::setResourceRootPath(const std::string& rootResDir)
|
||||||
m_resourceRootPath += '/';
|
m_resourceRootPath += '/';
|
||||||
}
|
}
|
||||||
CCFileUtils* pFileUtils = CCFileUtils::sharedFileUtils();
|
CCFileUtils* pFileUtils = CCFileUtils::sharedFileUtils();
|
||||||
std::vector<std::string> searchPaths = pFileUtils->getSearchPath();
|
std::vector<std::string> searchPaths = pFileUtils->getSearchPaths();
|
||||||
searchPaths.insert(searchPaths.begin(), m_resourceRootPath);
|
searchPaths.insert(searchPaths.begin(), m_resourceRootPath);
|
||||||
pFileUtils->setSearchPath(searchPaths);
|
pFileUtils->setSearchPaths(searchPaths);
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string& CCApplication::getResourceRootPath(void)
|
const std::string& CCApplication::getResourceRootPath(void)
|
||||||
|
|
|
@ -207,7 +207,7 @@ const std::vector<std::string>& CCFileUtils::getSearchResolutionsOrder()
|
||||||
return m_searchResolutionsOrderArray;
|
return m_searchResolutionsOrderArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCFileUtils::setSearchPath(const std::vector<std::string>& searchPaths)
|
void CCFileUtils::setSearchPaths(const std::vector<std::string>& searchPaths)
|
||||||
{
|
{
|
||||||
bool bExistDefault = false;
|
bool bExistDefault = false;
|
||||||
m_searchPathArray.clear();
|
m_searchPathArray.clear();
|
||||||
|
@ -225,7 +225,7 @@ void CCFileUtils::setSearchPath(const std::vector<std::string>& searchPaths)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<std::string>& CCFileUtils::getSearchPath()
|
const std::vector<std::string>& CCFileUtils::getSearchPaths()
|
||||||
{
|
{
|
||||||
return m_searchPathArray;
|
return m_searchPathArray;
|
||||||
}
|
}
|
||||||
|
|
|
@ -196,12 +196,12 @@ void CCFileUtils::setResourceDirectory(const char* pszResourceDirectory)
|
||||||
{
|
{
|
||||||
if (pszResourceDirectory == NULL) return;
|
if (pszResourceDirectory == NULL) return;
|
||||||
m_obDirectory = pszResourceDirectory;
|
m_obDirectory = pszResourceDirectory;
|
||||||
std::vector<std::string> searchPaths = this->getSearchPath();;
|
std::vector<std::string> searchPaths = this->getSearchPaths();;
|
||||||
searchPaths.insert(searchPaths.begin(), pszResourceDirectory);
|
searchPaths.insert(searchPaths.begin(), pszResourceDirectory);
|
||||||
this->setSearchPath(searchPaths);
|
this->setSearchPaths(searchPaths);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCFileUtils::setSearchPath(const std::vector<std::string>& searchPaths)
|
void CCFileUtils::setSearchPaths(const std::vector<std::string>& searchPaths)
|
||||||
{
|
{
|
||||||
bool bExistDefaultRootPath = false;
|
bool bExistDefaultRootPath = false;
|
||||||
|
|
||||||
|
|
|
@ -164,9 +164,9 @@ void CCApplication::setResourceRootPath(const std::string& rootResDir)
|
||||||
m_resourceRootPath += '/';
|
m_resourceRootPath += '/';
|
||||||
}
|
}
|
||||||
CCFileUtils* pFileUtils = CCFileUtils::sharedFileUtils();
|
CCFileUtils* pFileUtils = CCFileUtils::sharedFileUtils();
|
||||||
std::vector<std::string> searchPaths = pFileUtils->getSearchPath();
|
std::vector<std::string> searchPaths = pFileUtils->getSearchPaths();
|
||||||
searchPaths.insert(searchPaths.begin(), m_resourceRootPath);
|
searchPaths.insert(searchPaths.begin(), m_resourceRootPath);
|
||||||
pFileUtils->setSearchPath(searchPaths);
|
pFileUtils->setSearchPaths(searchPaths);
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string& CCApplication::getResourceRootPath(void)
|
const std::string& CCApplication::getResourceRootPath(void)
|
||||||
|
|
|
@ -38,13 +38,13 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the Resource root path.
|
* Sets the Resource root path.
|
||||||
* @deprecated Please use CCFileUtils::sharedFileUtils()->setSearchPath() instead.
|
* @deprecated Please use CCFileUtils::sharedFileUtils()->setSearchPaths() instead.
|
||||||
*/
|
*/
|
||||||
CC_DEPRECATED_ATTRIBUTE void setResourceRootPath(const std::string& rootResDir);
|
CC_DEPRECATED_ATTRIBUTE void setResourceRootPath(const std::string& rootResDir);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the Resource root path.
|
* Gets the Resource root path.
|
||||||
* @deprecated Please use CCFileUtils::sharedFileUtils()->getSearchPath() instead.
|
* @deprecated Please use CCFileUtils::sharedFileUtils()->getSearchPaths() instead.
|
||||||
*/
|
*/
|
||||||
CC_DEPRECATED_ATTRIBUTE const std::string& getResourceRootPath(void);
|
CC_DEPRECATED_ATTRIBUTE const std::string& getResourceRootPath(void);
|
||||||
|
|
||||||
|
|
|
@ -210,12 +210,12 @@ void CCFileUtils::setResourceDirectory(const char* pszResourceDirectory)
|
||||||
{
|
{
|
||||||
if (pszResourceDirectory == NULL) return;
|
if (pszResourceDirectory == NULL) return;
|
||||||
m_obDirectory = pszResourceDirectory;
|
m_obDirectory = pszResourceDirectory;
|
||||||
std::vector<std::string> searchPaths = this->getSearchPath();;
|
std::vector<std::string> searchPaths = this->getSearchPaths();;
|
||||||
searchPaths.insert(searchPaths.begin(), pszResourceDirectory);
|
searchPaths.insert(searchPaths.begin(), pszResourceDirectory);
|
||||||
this->setSearchPath(searchPaths);
|
this->setSearchPaths(searchPaths);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCFileUtils::setSearchPath(const std::vector<std::string>& searchPaths)
|
void CCFileUtils::setSearchPaths(const std::vector<std::string>& searchPaths)
|
||||||
{
|
{
|
||||||
bool bExistDefaultRootPath = false;
|
bool bExistDefaultRootPath = false;
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ bool AppDelegate::applicationDidFinishLaunching() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// set searching path
|
// set searching path
|
||||||
CCFileUtils::sharedFileUtils()->setSearchPath(searchPath);
|
CCFileUtils::sharedFileUtils()->setSearchPaths(searchPath);
|
||||||
|
|
||||||
// turn on display FPS
|
// turn on display FPS
|
||||||
pDirector->setDisplayStats(true);
|
pDirector->setDisplayStats(true);
|
||||||
|
|
|
@ -32,7 +32,7 @@ bool AppDelegate::applicationDidFinishLaunching()
|
||||||
CCSize resourceSize = CCSizeMake(960, 640);
|
CCSize resourceSize = CCSizeMake(960, 640);
|
||||||
std::vector<std::string> searchPaths;
|
std::vector<std::string> searchPaths;
|
||||||
searchPaths.push_back("hd");
|
searchPaths.push_back("hd");
|
||||||
pFileUtils->setSearchPath(searchPaths);
|
pFileUtils->setSearchPaths(searchPaths);
|
||||||
pDirector->setContentScaleFactor(resourceSize.height/designSize.height);
|
pDirector->setContentScaleFactor(resourceSize.height/designSize.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -138,10 +138,10 @@ void TestResolutionDirectories::onEnter()
|
||||||
string ret;
|
string ret;
|
||||||
|
|
||||||
sharedFileUtils->purgeCachedEntries();
|
sharedFileUtils->purgeCachedEntries();
|
||||||
m_defaultSearchPathArray = sharedFileUtils->getSearchPath();
|
m_defaultSearchPathArray = sharedFileUtils->getSearchPaths();
|
||||||
vector<string> searchPaths = m_defaultSearchPathArray;
|
vector<string> searchPaths = m_defaultSearchPathArray;
|
||||||
searchPaths.insert(searchPaths.begin(), "Misc");
|
searchPaths.insert(searchPaths.begin(), "Misc");
|
||||||
sharedFileUtils->setSearchPath(searchPaths);
|
sharedFileUtils->setSearchPaths(searchPaths);
|
||||||
|
|
||||||
m_defaultResolutionsOrderArray = sharedFileUtils->getSearchResolutionsOrder();
|
m_defaultResolutionsOrderArray = sharedFileUtils->getSearchResolutionsOrder();
|
||||||
vector<string> resolutionsOrder = m_defaultResolutionsOrderArray;
|
vector<string> resolutionsOrder = m_defaultResolutionsOrderArray;
|
||||||
|
@ -167,7 +167,7 @@ void TestResolutionDirectories::onExit()
|
||||||
CCFileUtils *sharedFileUtils = CCFileUtils::sharedFileUtils();
|
CCFileUtils *sharedFileUtils = CCFileUtils::sharedFileUtils();
|
||||||
|
|
||||||
// reset search path
|
// reset search path
|
||||||
sharedFileUtils->setSearchPath(m_defaultSearchPathArray);
|
sharedFileUtils->setSearchPaths(m_defaultSearchPathArray);
|
||||||
sharedFileUtils->setSearchResolutionsOrder(m_defaultResolutionsOrderArray);
|
sharedFileUtils->setSearchResolutionsOrder(m_defaultResolutionsOrderArray);
|
||||||
FileUtilsDemo::onExit();
|
FileUtilsDemo::onExit();
|
||||||
}
|
}
|
||||||
|
@ -192,7 +192,7 @@ void TestSearchPath::onEnter()
|
||||||
string ret;
|
string ret;
|
||||||
|
|
||||||
sharedFileUtils->purgeCachedEntries();
|
sharedFileUtils->purgeCachedEntries();
|
||||||
m_defaultSearchPathArray = sharedFileUtils->getSearchPath();
|
m_defaultSearchPathArray = sharedFileUtils->getSearchPaths();
|
||||||
vector<string> searchPaths = m_defaultSearchPathArray;
|
vector<string> searchPaths = m_defaultSearchPathArray;
|
||||||
string writablePath = sharedFileUtils->getWriteablePath();
|
string writablePath = sharedFileUtils->getWriteablePath();
|
||||||
string fileName = writablePath+"external.txt";
|
string fileName = writablePath+"external.txt";
|
||||||
|
@ -208,7 +208,7 @@ void TestSearchPath::onEnter()
|
||||||
searchPaths.insert(searchPaths.begin(), writablePath);
|
searchPaths.insert(searchPaths.begin(), writablePath);
|
||||||
searchPaths.insert(searchPaths.begin()+1, "Misc/searchpath1");
|
searchPaths.insert(searchPaths.begin()+1, "Misc/searchpath1");
|
||||||
searchPaths.insert(searchPaths.begin()+2, "Misc/searchpath2");
|
searchPaths.insert(searchPaths.begin()+2, "Misc/searchpath2");
|
||||||
sharedFileUtils->setSearchPath(searchPaths);
|
sharedFileUtils->setSearchPaths(searchPaths);
|
||||||
|
|
||||||
m_defaultResolutionsOrderArray = sharedFileUtils->getSearchResolutionsOrder();
|
m_defaultResolutionsOrderArray = sharedFileUtils->getSearchResolutionsOrder();
|
||||||
vector<string> resolutionsOrder = m_defaultResolutionsOrderArray;
|
vector<string> resolutionsOrder = m_defaultResolutionsOrderArray;
|
||||||
|
@ -242,7 +242,7 @@ void TestSearchPath::onExit()
|
||||||
CCFileUtils *sharedFileUtils = CCFileUtils::sharedFileUtils();
|
CCFileUtils *sharedFileUtils = CCFileUtils::sharedFileUtils();
|
||||||
|
|
||||||
// reset search path
|
// reset search path
|
||||||
sharedFileUtils->setSearchPath(m_defaultSearchPathArray);
|
sharedFileUtils->setSearchPaths(m_defaultSearchPathArray);
|
||||||
sharedFileUtils->setSearchResolutionsOrder(m_defaultResolutionsOrderArray);
|
sharedFileUtils->setSearchResolutionsOrder(m_defaultResolutionsOrderArray);
|
||||||
FileUtilsDemo::onExit();
|
FileUtilsDemo::onExit();
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ bool AppDelegate::applicationDidFinishLaunching()
|
||||||
searchPath.push_back("resources-iphonehd");
|
searchPath.push_back("resources-iphonehd");
|
||||||
}
|
}
|
||||||
|
|
||||||
CCFileUtils::sharedFileUtils()->setSearchPath(searchPath);
|
CCFileUtils::sharedFileUtils()->setSearchPaths(searchPath);
|
||||||
|
|
||||||
pDirector->setContentScaleFactor(resourceSize.height/designSize.height);
|
pDirector->setContentScaleFactor(resourceSize.height/designSize.height);
|
||||||
|
|
||||||
|
|
|
@ -100,9 +100,9 @@ bool AppDelegate::applicationDidFinishLaunching()
|
||||||
|
|
||||||
CCEGLView::sharedOpenGLView()->setDesignResolutionSize(designSize.width, designSize.height, kResolutionNoBorder);
|
CCEGLView::sharedOpenGLView()->setDesignResolutionSize(designSize.width, designSize.height, kResolutionNoBorder);
|
||||||
|
|
||||||
std::vector<std::string> searchPaths = pFileUtils->getSearchPath();
|
std::vector<std::string> searchPaths = pFileUtils->getSearchPaths();
|
||||||
searchPaths.insert(searchPaths.begin(), pFileUtils->getWriteablePath());
|
searchPaths.insert(searchPaths.begin(), pFileUtils->getWriteablePath());
|
||||||
pFileUtils->setSearchPath(searchPaths);
|
pFileUtils->setSearchPaths(searchPaths);
|
||||||
|
|
||||||
PlayerStatus::setDeviceResolution(res);
|
PlayerStatus::setDeviceResolution(res);
|
||||||
// turn on display FPS
|
// turn on display FPS
|
||||||
|
|
|
@ -41,7 +41,7 @@ bool AppDelegate::applicationDidFinishLaunching()
|
||||||
if (platform == kTargetIphone || platform == kTargetIpad)
|
if (platform == kTargetIphone || platform == kTargetIpad)
|
||||||
{
|
{
|
||||||
searchPaths.push_back("Published-iOS"); // Resources/Published-iOS
|
searchPaths.push_back("Published-iOS"); // Resources/Published-iOS
|
||||||
CCFileUtils::sharedFileUtils()->setSearchPath(searchPaths);
|
CCFileUtils::sharedFileUtils()->setSearchPaths(searchPaths);
|
||||||
|
|
||||||
if (screenSize.height > 480)
|
if (screenSize.height > 480)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit b744bb4009bdd74d428587ba51d991294b549be4
|
Subproject commit 3459984d2ff434c51be47ed51e8e24882b25a641
|
|
@ -2567,7 +2567,7 @@ JSBool js_cocos2dx_CCFileUtils_setSearchResolutionsOrder(JSContext *cx, uint32_t
|
||||||
return JS_FALSE;
|
return JS_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
JSBool js_cocos2dx_CCFileUtils_setSearchPath(JSContext *cx, uint32_t argc, jsval *vp)
|
JSBool js_cocos2dx_CCFileUtils_setSearchPaths(JSContext *cx, uint32_t argc, jsval *vp)
|
||||||
{
|
{
|
||||||
jsval *argv = JS_ARGV(cx, vp);
|
jsval *argv = JS_ARGV(cx, vp);
|
||||||
JSBool ok = JS_TRUE;
|
JSBool ok = JS_TRUE;
|
||||||
|
@ -2580,14 +2580,14 @@ JSBool js_cocos2dx_CCFileUtils_setSearchPath(JSContext *cx, uint32_t argc, jsval
|
||||||
std::vector<std::string> arg0;
|
std::vector<std::string> arg0;
|
||||||
ok &= jsval_to_string_vector(cx, argv[0], arg0);
|
ok &= jsval_to_string_vector(cx, argv[0], arg0);
|
||||||
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
|
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
|
||||||
cobj->setSearchPath(arg0);
|
cobj->setSearchPaths(arg0);
|
||||||
JS_SET_RVAL(cx, vp, JSVAL_VOID);
|
JS_SET_RVAL(cx, vp, JSVAL_VOID);
|
||||||
return JS_TRUE;
|
return JS_TRUE;
|
||||||
}
|
}
|
||||||
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
|
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||||
return JS_FALSE;
|
return JS_FALSE;
|
||||||
}
|
}
|
||||||
JSBool js_cocos2dx_CCFileUtils_getSearchPath(JSContext *cx, uint32_t argc, jsval *vp)
|
JSBool js_cocos2dx_CCFileUtils_getSearchPaths(JSContext *cx, uint32_t argc, jsval *vp)
|
||||||
{
|
{
|
||||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||||
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
|
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
|
||||||
|
@ -2595,7 +2595,7 @@ JSBool js_cocos2dx_CCFileUtils_getSearchPath(JSContext *cx, uint32_t argc, jsval
|
||||||
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
|
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
|
||||||
|
|
||||||
if (argc == 0) {
|
if (argc == 0) {
|
||||||
std::vector<std::string> ret = cobj->getSearchPath();
|
std::vector<std::string> ret = cobj->getSearchPaths();
|
||||||
jsval jsret;
|
jsval jsret;
|
||||||
jsret = string_vector_to_jsval(cx, ret);
|
jsret = string_vector_to_jsval(cx, ret);
|
||||||
JS_SET_RVAL(cx, vp, jsret);
|
JS_SET_RVAL(cx, vp, jsret);
|
||||||
|
@ -2675,8 +2675,8 @@ void register_cocos2dx_js_extensions(JSContext* cx, JSObject* global)
|
||||||
JS_DefineFunction(cx, js_cocos2dx_CCMenu_prototype, "alignItemsInColumns", js_cocos2dx_CCMenu_alignItemsInColumns, 1, JSPROP_ENUMERATE | JSPROP_SHARED | JSPROP_PERMANENT);
|
JS_DefineFunction(cx, js_cocos2dx_CCMenu_prototype, "alignItemsInColumns", js_cocos2dx_CCMenu_alignItemsInColumns, 1, JSPROP_ENUMERATE | JSPROP_SHARED | JSPROP_PERMANENT);
|
||||||
|
|
||||||
JS_DefineFunction(cx, js_cocos2dx_CCFileUtils_prototype, "setSearchResolutionsOrder", js_cocos2dx_CCFileUtils_setSearchResolutionsOrder, 1, JSPROP_PERMANENT | JSPROP_SHARED);
|
JS_DefineFunction(cx, js_cocos2dx_CCFileUtils_prototype, "setSearchResolutionsOrder", js_cocos2dx_CCFileUtils_setSearchResolutionsOrder, 1, JSPROP_PERMANENT | JSPROP_SHARED);
|
||||||
JS_DefineFunction(cx, js_cocos2dx_CCFileUtils_prototype, "setSearchPath", js_cocos2dx_CCFileUtils_setSearchPath, 1, JSPROP_PERMANENT | JSPROP_SHARED);
|
JS_DefineFunction(cx, js_cocos2dx_CCFileUtils_prototype, "setSearchPaths", js_cocos2dx_CCFileUtils_setSearchPaths, 1, JSPROP_PERMANENT | JSPROP_SHARED);
|
||||||
JS_DefineFunction(cx, js_cocos2dx_CCFileUtils_prototype, "getSearchPath", js_cocos2dx_CCFileUtils_getSearchPath, 0, JSPROP_PERMANENT | JSPROP_SHARED);
|
JS_DefineFunction(cx, js_cocos2dx_CCFileUtils_prototype, "getSearchPaths", js_cocos2dx_CCFileUtils_getSearchPaths, 0, JSPROP_PERMANENT | JSPROP_SHARED);
|
||||||
JS_DefineFunction(cx, js_cocos2dx_CCFileUtils_prototype, "getSearchResolutionsOrder", js_cocos2dx_CCFileUtils_getSearchResolutionsOrder, 0, JSPROP_PERMANENT | JSPROP_SHARED);
|
JS_DefineFunction(cx, js_cocos2dx_CCFileUtils_prototype, "getSearchResolutionsOrder", js_cocos2dx_CCFileUtils_getSearchResolutionsOrder, 0, JSPROP_PERMANENT | JSPROP_SHARED);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,7 @@ skip = CCNode::[.*Transform convertToWindowSpace getChildren ^setPosition$ getGr
|
||||||
CCTimer::[getSelector],
|
CCTimer::[getSelector],
|
||||||
CC.*Loader$::[*],
|
CC.*Loader$::[*],
|
||||||
*::[copyWith.* onEnter.* onExit.* description getObjectType .*RGB.* .*HSV.*],
|
*::[copyWith.* onEnter.* onExit.* description getObjectType .*RGB.* .*HSV.*],
|
||||||
CCFileUtils::[(g|s)etSearchResolutionsOrder$ (g|s)etSearchPath$]
|
CCFileUtils::[(g|s)etSearchResolutionsOrder$ (g|s)etSearchPaths$]
|
||||||
|
|
||||||
rename_functions = CCDirector::[sharedDirector=getInstance],
|
rename_functions = CCDirector::[sharedDirector=getInstance],
|
||||||
CCSpriteFrameCache::[sharedSpriteFrameCache=getInstance addSpriteFramesWithFile=addSpriteFrames spriteFrameByName=getSpriteFrame isFlipX=isFlippedX isFlipY=isFlippedY],
|
CCSpriteFrameCache::[sharedSpriteFrameCache=getInstance addSpriteFramesWithFile=addSpriteFrames spriteFrameByName=getSpriteFrame isFlipX=isFlippedX isFlipY=isFlippedY],
|
||||||
|
|
|
@ -99,7 +99,7 @@ skip = CCNode::[.*Transform convertToWindowSpace getChildren ^setPosition$ getGr
|
||||||
CCTimer::[getSelector],
|
CCTimer::[getSelector],
|
||||||
CC.*Loader$::[*],
|
CC.*Loader$::[*],
|
||||||
*::[copyWith.* onEnter.* onExit.* description getObjectType .*RGB.* .*HSV.*],
|
*::[copyWith.* onEnter.* onExit.* description getObjectType .*RGB.* .*HSV.*],
|
||||||
CCFileUtils::[(g|s)etSearchResolutionsOrder$ (g|s)etSearchPath$]
|
CCFileUtils::[(g|s)etSearchResolutionsOrder$ (g|s)etSearchPaths$]
|
||||||
|
|
||||||
rename_functions = CCDirector::[sharedDirector=getInstance],
|
rename_functions = CCDirector::[sharedDirector=getInstance],
|
||||||
CCSpriteFrameCache::[sharedSpriteFrameCache=getInstance addSpriteFramesWithFile=addSpriteFrames spriteFrameByName=getSpriteFrame isFlipX=isFlippedX isFlipY=isFlippedY],
|
CCSpriteFrameCache::[sharedSpriteFrameCache=getInstance addSpriteFramesWithFile=addSpriteFrames spriteFrameByName=getSpriteFrame isFlipX=isFlippedX isFlipY=isFlippedY],
|
||||||
|
|
Loading…
Reference in New Issue