1
0
forked from 0ad/0ad

Include *.DELETED files when building archives. See #1110.

This was SVN commit r10907.
This commit is contained in:
Ykkrosh 2012-01-14 18:46:20 +00:00
parent 906e713880
commit 1389e754de
3 changed files with 17 additions and 7 deletions

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2010 Wildfire Games /* Copyright (c) 2012 Wildfire Games
* *
* Permission is hereby granted, free of charge, to any person obtaining * Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the * a copy of this software and associated documentation files (the
@ -57,7 +57,15 @@ enum VfsMountFlags
* return ERR::VFS_DIR_NOT_FOUND if the given real path doesn't exist. * return ERR::VFS_DIR_NOT_FOUND if the given real path doesn't exist.
* (the default behavior is to create all real directories in the path) * (the default behavior is to create all real directories in the path)
**/ **/
VFS_MOUNT_MUST_EXIST = 4 VFS_MOUNT_MUST_EXIST = 4,
/**
* keep the files named "*.DELETED" visible in the VFS directories.
* the standard behavior of hiding the file with the same name minus the
* ".DELETED" suffix will still apply.
* (the default behavior is to hide both the suffixed and unsuffixed files)
**/
VFS_MOUNT_KEEP_DELETED = 8
}; };
// (member functions are thread-safe after the instance has been // (member functions are thread-safe after the instance has been

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2010 Wildfire Games /* Copyright (c) 2012 Wildfire Games
* *
* Permission is hereby granted, free of charge, to any person obtaining * Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the * a copy of this software and associated documentation files (the
@ -88,7 +88,8 @@ private:
if(name.Extension() == L".DELETED") if(name.Extension() == L".DELETED")
{ {
m_directory->RemoveFile(name.Basename()); m_directory->RemoveFile(name.Basename());
return; if(!(m_realDirectory->Flags() & VFS_MOUNT_KEEP_DELETED))
return;
} }
const VfsFile file(name, (size_t)fileInfo.Size(), fileInfo.MTime(), m_realDirectory->Priority(), m_realDirectory); const VfsFile file(name, (size_t)fileInfo.Size(), fileInfo.MTime(), m_realDirectory->Priority(), m_realDirectory);
@ -121,7 +122,8 @@ private:
if(name.Extension() == L".DELETED") if(name.Extension() == L".DELETED")
{ {
directory->RemoveFile(name.Basename()); directory->RemoveFile(name.Basename());
return; if(!(this_->m_realDirectory->Flags() & VFS_MOUNT_KEEP_DELETED))
return;
} }
const VfsFile file(name, (size_t)fileInfo.Size(), fileInfo.MTime(), this_->m_realDirectory->Priority(), archiveFile); const VfsFile file(name, (size_t)fileInfo.Size(), fileInfo.MTime(), this_->m_realDirectory->Priority(), archiveFile);

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010 Wildfire Games. /* Copyright (C) 2012 Wildfire Games.
* This file is part of 0 A.D. * This file is part of 0 A.D.
* *
* 0 A.D. is free software: you can redistribute it and/or modify * 0 A.D. is free software: you can redistribute it and/or modify
@ -43,7 +43,7 @@ CArchiveBuilder::CArchiveBuilder(const OsPath& mod, const OsPath& tempdir) :
m_VFS->Mount(L"cache/", m_TempDir/"_archivecache/"); m_VFS->Mount(L"cache/", m_TempDir/"_archivecache/");
m_VFS->Mount(L"", mod/"", VFS_MOUNT_MUST_EXIST); m_VFS->Mount(L"", mod/"", VFS_MOUNT_MUST_EXIST | VFS_MOUNT_KEEP_DELETED);
// Collect the list of files before loading any base mods // Collect the list of files before loading any base mods
vfs::ForEachFile(m_VFS, L"", &CollectFileCB, (uintptr_t)static_cast<void*>(this), 0, vfs::DIR_RECURSIVE); vfs::ForEachFile(m_VFS, L"", &CollectFileCB, (uintptr_t)static_cast<void*>(this), 0, vfs::DIR_RECURSIVE);