Index: source/main.cpp =================================================================== --- source/main.cpp +++ source/main.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2018 Wildfire Games. +/* Copyright (C) 2019 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -585,7 +585,7 @@ for (size_t i = 0; i < mods.size(); ++i) builder.AddBaseMod(paths.RData()/"mods"/mods[i]); - builder.Build(zip, args.Has("archivebuild-compress")); + builder.Build(zip, args.Has("archivebuild-compress"), args.Get("ignore-mask")); CXeromyces::Terminate(); return; Index: source/ps/ArchiveBuilder.h =================================================================== --- source/ps/ArchiveBuilder.h +++ source/ps/ArchiveBuilder.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2014 Wildfire Games. +/* Copyright (C) 2019 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -55,7 +55,7 @@ * @param archive path of .zip file to generate (will be overwritten if it exists) * @param compress whether to compress the contents of the .zip file */ - void Build(const OsPath& archive, bool compress); + void Build(const OsPath& archive, bool compress, const CStr8& filter) const; private: static Status CollectFileCB(const VfsPath& pathname, const CFileInfo& fileInfo, const uintptr_t cbData); Index: source/ps/ArchiveBuilder.cpp =================================================================== --- source/ps/ArchiveBuilder.cpp +++ source/ps/ArchiveBuilder.cpp @@ -21,6 +21,7 @@ #include "graphics/TextureManager.h" #include "graphics/ColladaManager.h" +#include "lib/regex.h" #include "lib/tex/tex_codec.h" #include "lib/file/archive/archive_zip.h" #include "lib/file/vfs/vfs_util.h" @@ -58,16 +59,15 @@ m_VFS->Mount(L"", mod/"", VFS_MOUNT_MUST_EXIST, ++m_NumBaseMods); } -void CArchiveBuilder::Build(const OsPath& archive, bool compress) +void CArchiveBuilder::Build(const OsPath& archive, bool compress, const CStr8& filter) const { // By default we disable zip compression because it significantly hurts download // size for releases (which re-compress all files with better compression // algorithms) - it's probably most important currently to optimise for // download size rather than install size or startup performance. // (See http://trac.wildfiregames.com/ticket/671) - const bool noDeflate = !compress; - PIArchiveWriter writer = CreateArchiveWriter_Zip(archive, noDeflate); + PIArchiveWriter writer = CreateArchiveWriter_Zip(archive, !compress); // Use CTextureManager instead of CTextureConverter directly, // so it can deal with all the loading of settings.xml files @@ -95,7 +95,7 @@ ) { VfsPath cachedPath; - debug_printf("Converting texture %s\n", realPath.string8().c_str()); + debug_printf("Converting texture '%s'\n", realPath.string8().c_str()); bool ok = textureManager.GenerateCachedTexture(path, cachedPath); ENSURE(ok); @@ -127,7 +127,7 @@ } VfsPath cachedPath; - debug_printf("Converting model %s\n", realPath.string8().c_str()); + debug_printf("Converting model '%s'\n", realPath.string8().c_str()); bool ok = colladaManager.GenerateCachedFile(path, type, cachedPath); // The DAE might fail to convert for whatever reason, and in that case @@ -147,14 +147,18 @@ continue; } - debug_printf("Adding %s\n", realPath.string8().c_str()); - writer->AddFile(realPath, path); + if (!match_wildcard(filter.FromUTF8().c_str(), path.Filename().string().c_str())) + { + debug_printf("Adding '%s'\n", realPath.string8().c_str()); + writer->AddFile(realPath, path); + continue; + } // Also cache XMB versions of all XML files if (path.Extension() == L".xml") { VfsPath cachedPath; - debug_printf("Converting XML file %s\n", realPath.string8().c_str()); + debug_printf("Converting XML file '%s'\n", realPath.string8().c_str()); bool ok = xero.GenerateCachedXMB(m_VFS, path, cachedPath); ENSURE(ok); @@ -166,7 +170,7 @@ } } - debug_printf("Finished packaging \"%s\".", archive.string8().c_str()); + debug_printf("Finished packaging '%s'.", archive.string8().c_str()); } Status CArchiveBuilder::CollectFileCB(const VfsPath& pathname, const CFileInfo& UNUSED(fileInfo), const uintptr_t cbData)