MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / MakeModDownloadTask

Function MakeModDownloadTask

engine/Poseidon/UI/ModDownloadSupport.hpp:69–87  ·  view source on GitHub ↗

A DownloadTask that fetches the zstd-wrapped mod artifact to / .pbo.zst and unpacks it into / . ModArchive::Unpack streams the zstd decode. `modId` is the catalog id; `folderName` is the physical install folder.

Source from the content-addressed store, hash-verified

67}
68
69// A DownloadTask that fetches the zstd-wrapped mod artifact to <root>/<folderName>.pbo.zst and
70// unpacks it into <root>/<folderName>. ModArchive::Unpack streams the zstd decode.
71// `modId` is the catalog id; `folderName` is the physical install folder.
72inline DownloadTask MakeModDownloadTask(const std::string& modId, const std::string& name, const std::string& url,
73 int64_t sizeBytes, const std::string& root,
74 std::vector<StagedModInstall>& installs, const std::string& folderName = {},
75 const std::string& version = {}, int64_t packageRevision = 1,
76 const std::string& sha256 = {})
77{
78 const std::string destDir = ModInstallDir(root, modId, folderName);
79 StagedModInstall install = MakeStagedModInstall(destDir, modId);
80 const std::string stagingDir = install.stagingDir;
81 DownloadTask t;
82 t.label = name.empty() ? modId : name;
83 t.url = url;
84 t.destPath = stagingDir + ".pbo.zst";
85 t.expectedBytes = sizeBytes;
86 t.postStep = [stagingDir, modId, name, version, folderName, url, sizeBytes, packageRevision,
87 sha256](const DownloadTask& task, std::string& error) -> bool
88 {
89 if (!VerifyModArtifact(task.destPath, sizeBytes, sha256, &error))
90 return false;

Callers 1

BeginModdedJoinMethod · 0.85

Calls 3

ModInstallDirFunction · 0.85
emptyMethod · 0.45

Tested by

no test coverage detected