Add command-line option to enable archivebuilder compression

This was SVN commit r11373.
This commit is contained in:
Ykkrosh
2012-03-19 21:16:12 +00:00
parent 36107cb7e1
commit 700e28480d
4 changed files with 9 additions and 6 deletions
+2
View File
@@ -61,5 +61,7 @@ Windows-specific:
Archive builder: Archive builder:
-archivebuild=PATH system PATH of the base directory containing mod data to be archived/precached -archivebuild=PATH system PATH of the base directory containing mod data to be archived/precached
-archivebuild-output=PATH system PATH to output of the resulting .zip archive (use with archivebuild) -archivebuild-output=PATH system PATH to output of the resulting .zip archive (use with archivebuild)
-archivebuild-compress enable deflate compression in the .zip
(no zip compression by default since it hurts compression of release packages)
-buildarchive (disabled) -buildarchive (disabled)
+1 -1
View File
@@ -509,7 +509,7 @@ static void RunGameOrAtlas(int argc, const char* argv[])
zip = mod.Filename().ChangeExtension(L".zip"); zip = mod.Filename().ChangeExtension(L".zip");
CArchiveBuilder builder(mod, paths.Cache()); CArchiveBuilder builder(mod, paths.Cache());
builder.Build(zip); builder.Build(zip, args.Has("archivebuild-compress"));
CXeromyces::Terminate(); CXeromyces::Terminate();
return; return;
+4 -4
View File
@@ -64,14 +64,14 @@ void CArchiveBuilder::AddBaseMod(const OsPath& mod)
m_VFS->Mount(L"", mod/"", VFS_MOUNT_MUST_EXIST); m_VFS->Mount(L"", mod/"", VFS_MOUNT_MUST_EXIST);
} }
void CArchiveBuilder::Build(const OsPath& archive) void CArchiveBuilder::Build(const OsPath& archive, bool compress)
{ {
// Disable zip compression because it significantly hurts download size // By default we disable zip compression because it significantly hurts download
// for releases (which re-compress all files with better compression // size for releases (which re-compress all files with better compression
// algorithms) - it's probably most important currently to optimise for // algorithms) - it's probably most important currently to optimise for
// download size rather than install size or startup performance. // download size rather than install size or startup performance.
// (See http://trac.wildfiregames.com/ticket/671) // (See http://trac.wildfiregames.com/ticket/671)
const bool noDeflate = true; const bool noDeflate = !compress;
PIArchiveWriter writer = CreateArchiveWriter_Zip(archive, noDeflate); PIArchiveWriter writer = CreateArchiveWriter_Zip(archive, noDeflate);
+2 -1
View File
@@ -52,8 +52,9 @@ public:
/** /**
* Do all the processing and packing of files into the archive. * Do all the processing and packing of files into the archive.
* @param archive path of .zip file to generate (will be overwritten if it exists) * @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); void Build(const OsPath& archive, bool compress);
private: private:
static Status CollectFileCB(const VfsPath& pathname, const FileInfo& fileInfo, const uintptr_t cbData); static Status CollectFileCB(const VfsPath& pathname, const FileInfo& fileInfo, const uintptr_t cbData);