mirror of https://github.com/axmolengine/axmol.git
Merge pull request #2344 from minggo/userdefault-hotfix
fixed #2034:use previous path to get UserDefault.xml
This commit is contained in:
commit
6bbf4517b7
|
@ -451,7 +451,13 @@ void CCUserDefault::initXMLFilePath()
|
||||||
#ifdef KEEP_COMPATABILITY
|
#ifdef KEEP_COMPATABILITY
|
||||||
if (! m_sbIsFilePathInitialized)
|
if (! m_sbIsFilePathInitialized)
|
||||||
{
|
{
|
||||||
m_sFilePath += CCFileUtils::sharedFileUtils()->getWritablePath() + XML_FILE_NAME;
|
// xml file is stored in cache directory before 2.1.2
|
||||||
|
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
|
||||||
|
NSString *documentsDirectory = [paths objectAtIndex:0];
|
||||||
|
m_sFilePath = [documentsDirectory UTF8String];
|
||||||
|
m_sFilePath.append("/");
|
||||||
|
|
||||||
|
m_sFilePath += XML_FILE_NAME;
|
||||||
m_sbIsFilePathInitialized = true;
|
m_sbIsFilePathInitialized = true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -412,7 +412,8 @@ void CCUserDefault::initXMLFilePath()
|
||||||
#ifdef KEEP_COMPATABILITY
|
#ifdef KEEP_COMPATABILITY
|
||||||
if (! m_sbIsFilePathInitialized)
|
if (! m_sbIsFilePathInitialized)
|
||||||
{
|
{
|
||||||
m_sFilePath += CCFileUtils::sharedFileUtils()->getWritablePath() + XML_FILE_NAME;
|
// UserDefault.xml is stored in /data/data/<package-path>/ before v2.1.2
|
||||||
|
m_sFilePath += "/data/data/" + getPackageNameJNI() + "/" + XML_FILE_NAME;
|
||||||
m_sbIsFilePathInitialized = true;
|
m_sbIsFilePathInitialized = true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue