MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / GetFullFilename

Function GetFullFilename

src/network/network_content.cpp:371–381  ·  view source on GitHub ↗

* Determine the full filename of a piece of content information * @param ci the information to get the filename from * @param compressed should the filename end with .gz? * @return a statically allocated buffer with the filename or * nullptr when no filename could be made. */

Source from the content-addressed store, hash-verified

369 * nullptr when no filename could be made.
370 */
371static std::string GetFullFilename(const ContentInfo &ci, bool compressed)
372{
373 Subdirectory dir = GetContentInfoSubDir(ci.type);
374 if (dir == NO_DIRECTORY) return {};
375
376 std::string buf = FioGetDirectory(SP_AUTODOWNLOAD_DIR, dir);
377 buf += ci.filename;
378 buf += compressed ? ".tar.gz" : ".tar";
379
380 return buf;
381}
382
383/**
384 * Gunzip a given file and remove the .gz if successful.

Callers 3

GunzipFileFunction · 0.85
BeforeDownloadMethod · 0.85
AfterDownloadMethod · 0.85

Calls 2

GetContentInfoSubDirFunction · 0.85
FioGetDirectoryFunction · 0.85

Tested by

no test coverage detected