Merge branch 'dev' into dev

This commit is contained in:
kaitian521
2023-08-11 21:32:26 +08:00
committed by GitHub
42 changed files with 272 additions and 205 deletions
+8 -4
View File
@@ -201,7 +201,7 @@ void MemoryFile::reloadFromFile(size_t expectedCapacity) {
if (isFileValid()) {
MMKVWarning("calling reloadFromFile while the cache [%s] is still valid", m_diskFile.m_path.c_str());
MMKV_ASSERT(0);
clearMemoryCache();
doCleanMemoryCache(false);
}
if (!m_diskFile.open()) {
@@ -275,15 +275,19 @@ extern bool mkPath(const MMKVPath_t &str) {
if (stat(path, &sb) != 0) {
if (errno != ENOENT || mkdir(path, 0777) != 0) {
MMKVWarning("%s : %s", path, strerror(errno));
free(path);
return false;
// there's report that some Android devices might not have access permission on parent dir
if (done) {
free(path);
return false;
}
goto LContinue;
}
} else if (!S_ISDIR(sb.st_mode)) {
MMKVWarning("%s: %s", path, strerror(ENOTDIR));
free(path);
return false;
}
LContinue:
*slash = '/';
}
free(path);