mirror of https://github.com/axmolengine/axmol.git
fixed #2260: make CCDictionary::createWithContentsOfFile() return NULL when the file is missing
This commit is contained in:
parent
a63f67afac
commit
a8fe210c7e
|
@ -307,13 +307,20 @@ CCDictionary* CCFileUtilsIOS::createCCDictionaryWithContentsOfFile(const std::st
|
|||
NSString* pPath = [NSString stringWithUTF8String:fullPath.c_str()];
|
||||
NSDictionary* pDict = [NSDictionary dictionaryWithContentsOfFile:pPath];
|
||||
|
||||
CCDictionary* pRet = new CCDictionary();
|
||||
for (id key in [pDict allKeys]) {
|
||||
id value = [pDict objectForKey:key];
|
||||
addValueToCCDict(key, value, pRet);
|
||||
if (pDict != nil)
|
||||
{
|
||||
CCDictionary* pRet = new CCDictionary();
|
||||
for (id key in [pDict allKeys]) {
|
||||
id value = [pDict objectForKey:key];
|
||||
addValueToCCDict(key, value, pRet);
|
||||
}
|
||||
|
||||
return pRet;
|
||||
}
|
||||
else
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return pRet;
|
||||
}
|
||||
|
||||
bool CCFileUtilsIOS::writeToFile(CCDictionary *dict, const std::string &fullPath)
|
||||
|
|
Loading…
Reference in New Issue