From 1389e754de5eadcb7ef71304bbb12477977b3cf3 Mon Sep 17 00:00:00 2001 From: Ykkrosh Date: Sat, 14 Jan 2012 18:46:20 +0000 Subject: [PATCH] Include *.DELETED files when building archives. See #1110. This was SVN commit r10907. --- source/lib/file/vfs/vfs.h | 12 ++++++++++-- source/lib/file/vfs/vfs_populate.cpp | 8 +++++--- source/ps/ArchiveBuilder.cpp | 4 ++-- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/source/lib/file/vfs/vfs.h b/source/lib/file/vfs/vfs.h index c32b0270f6..068d5ad849 100644 --- a/source/lib/file/vfs/vfs.h +++ b/source/lib/file/vfs/vfs.h @@ -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 * 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. * (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 diff --git a/source/lib/file/vfs/vfs_populate.cpp b/source/lib/file/vfs/vfs_populate.cpp index 78fc0767ba..8e3975ebf3 100644 --- a/source/lib/file/vfs/vfs_populate.cpp +++ b/source/lib/file/vfs/vfs_populate.cpp @@ -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 * a copy of this software and associated documentation files (the @@ -88,7 +88,8 @@ private: if(name.Extension() == L".DELETED") { 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); @@ -121,7 +122,8 @@ private: if(name.Extension() == L".DELETED") { 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); diff --git a/source/ps/ArchiveBuilder.cpp b/source/ps/ArchiveBuilder.cpp index 7dfc9df142..41188b01a5 100644 --- a/source/ps/ArchiveBuilder.cpp +++ b/source/ps/ArchiveBuilder.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2010 Wildfire Games. +/* Copyright (C) 2012 Wildfire Games. * This file is part of 0 A.D. * * 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"", 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 vfs::ForEachFile(m_VFS, L"", &CollectFileCB, (uintptr_t)static_cast(this), 0, vfs::DIR_RECURSIVE);