diff --git a/source/graphics/ColladaManager.cpp b/source/graphics/ColladaManager.cpp index fc9ddd3e9e..7b6fcc658f 100644 --- a/source/graphics/ColladaManager.cpp +++ b/source/graphics/ColladaManager.cpp @@ -121,7 +121,11 @@ public: case CColladaManager::PSA: convert_dae_to_psa(daeData.c_str(), ColladaOutput, &writeBuffer); break; } - g_VFS->CreateFile(pmdFilename, writeBuffer.Data(), writeBuffer.Size()); + // don't create zero-length files (as happens in test_invalid_dae when + // we deliberately pass invalid XML data) because the VFS caching + // logic warns when asked to load such. + if(writeBuffer.Size()) + g_VFS->CreateFile(pmdFilename, writeBuffer.Data(), writeBuffer.Size()); return true; } diff --git a/source/graphics/tests/test_MeshManager.h b/source/graphics/tests/test_MeshManager.h index 9c12841e3d..01dfc18c8e 100644 --- a/source/graphics/tests/test_MeshManager.h +++ b/source/graphics/tests/test_MeshManager.h @@ -37,10 +37,10 @@ class TestMeshManager : public CxxTest::TestSuite // Make sure the required directories doesn't exist when we start, // in case the previous test aborted and left them full of junk -// if(exists(MOD_PATH)) -// fsPosix.DeleteDirectory(MOD_PATH); -// if(exists(MOD_PATH)) -// fsPosix.DeleteDirectory(CACHE_PATH); + if(exists(MOD_PATH)) + fsPosix.DeleteDirectory(MOD_PATH); + if(exists(CACHE_PATH)) + fsPosix.DeleteDirectory(CACHE_PATH); TS_ASSERT(fs::create_directory(MOD_PATH.external_directory_string())); TS_ASSERT(fs::create_directory(CACHE_PATH.external_directory_string())); diff --git a/source/lib/file/vfs/vfs_lookup.cpp b/source/lib/file/vfs/vfs_lookup.cpp index 32021a92d9..bd0e745421 100644 --- a/source/lib/file/vfs/vfs_lookup.cpp +++ b/source/lib/file/vfs/vfs_lookup.cpp @@ -154,8 +154,6 @@ TIMER_ACCRUE(tc_lookup); if(pathname.empty()) // (prevent iterator error in loop end condition) return INFO::OK; - Path currentPath; // (.. thus far; used when createMissingDirectories) - // for each directory component: VfsPath::iterator it; // (used outside of loop to get filename) for(it = pathname.begin(); it != --pathname.end(); ++it) @@ -171,18 +169,16 @@ TIMER_ACCRUE(tc_lookup); return ERR::VFS_DIR_NOT_FOUND; // NOWARN } - if(createMissingDirectories) + if(createMissingDirectories && !subdirectory->AssociatedDirectory()) { - if(subdirectory->AssociatedDirectory()) - currentPath /= subdirectory->AssociatedDirectory()->GetPath().leaf(); - else + Path currentPath; + if(directory->AssociatedDirectory()) // (is NULL when mounting into root) + currentPath = directory->AssociatedDirectory()->GetPath()/subdirectoryName; + + if(mkdir(currentPath.external_directory_string().c_str(), S_IRWXO|S_IRWXU|S_IRWXG) == 0) { - currentPath /= subdirectoryName; - if(mkdir(currentPath.external_directory_string().c_str(), S_IRWXO|S_IRWXU|S_IRWXG) == 0) - { - PRealDirectory realDirectory(new RealDirectory(currentPath, 0, 0)); - subdirectory->Attach(realDirectory); - } + PRealDirectory realDirectory(new RealDirectory(currentPath, 0, 0)); + subdirectory->Attach(realDirectory); } } diff --git a/source/ps/XML/XMLUtils.cpp b/source/ps/XML/XMLUtils.cpp index 23bdca1a55..2560a09a54 100644 --- a/source/ps/XML/XMLUtils.cpp +++ b/source/ps/XML/XMLUtils.cpp @@ -51,7 +51,7 @@ int CVFSInputSource::OpenFile(const VfsPath& path) LibError ret = g_VFS->LoadFile(path, m_pBuffer, m_BufferSize); if(ret != INFO::OK) { - LOG(CLogger::Error, LOG_CATEGORY, "CVFSInputSource: file %s couldn't be loaded (LoadFile: %d)", path, ret); + LOG(CLogger::Error, LOG_CATEGORY, "CVFSInputSource: file %s couldn't be loaded (LoadFile: %d)", path.string().c_str(), ret); return -1; }