1
0
forked from 0ad/0ad

when mounting a mod, don't attempt to create the directories (it's reasonable to assume the mod must exist, there is no value in creating a dummy mod directory - unlike the screenshots/logs etc. mounts)

this fixes write errors because mods/internal doesn't exist in public
SVN checkouts and the default mount logic tries to mount internal anyway
(and now just fails that operation silently)
fixes #458

This was SVN commit r7375.
This commit is contained in:
janwas 2010-03-20 18:12:48 +00:00
parent bdfe28766a
commit 4059826759
3 changed files with 15 additions and 3 deletions

View File

@ -49,7 +49,13 @@ public:
virtual LibError Mount(const VfsPath& mountPoint, const fs::wpath& path, size_t flags /* = 0 */, size_t priority /* = 0 */)
{
RETURN_ERR(CreateDirectories(path, 0700));
if(!fs::exists(path))
{
if(flags & VFS_MOUNT_MUST_EXIST)
return ERR::VFS_DIR_NOT_FOUND; // NOWARN
else
RETURN_ERR(CreateDirectories(path, 0700));
}
VfsDirectory* directory;
CHECK_ERR(vfs_Lookup(mountPoint, &m_rootDirectory, directory, 0, VFS_LOOKUP_ADD|VFS_LOOKUP_CREATE));

View File

@ -51,7 +51,13 @@ enum VfsMountFlags
/**
* anything mounted from here should be included when building archives.
**/
VFS_MOUNT_ARCHIVABLE = 2
VFS_MOUNT_ARCHIVABLE = 2,
/**
* return ERR::VFS_DIR_NOT_FOUND if the given real path doesn't exist.
* (the default behaviour is to create all real directories in the path)
**/
VFS_MOUNT_MUST_EXIST = 4
};
struct IVFS

View File

@ -531,7 +531,7 @@ static void InitVfs(const CmdLineArgs& args)
for (size_t i = 0; i < mods.size(); ++i)
{
size_t priority = i;
int flags = VFS_MOUNT_WATCH|VFS_MOUNT_ARCHIVABLE;
size_t flags = VFS_MOUNT_WATCH|VFS_MOUNT_ARCHIVABLE|VFS_MOUNT_MUST_EXIST;
std::wstring modName (wstring_from_utf8(mods[i]));
g_VFS->Mount(L"", AddSlash(modLoosePath/modName), flags, priority);
g_VFS->Mount(L"", AddSlash(modArchivePath/modName), flags, priority);