MCPcopy Create free account
hub / github.com/TDesktop-x64/tdesktop / writePreloadedFile

Method writePreloadedFile

Telegram/SourceFiles/export/export_api_wrap.cpp:2698–2719  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2696}
2697
2698bool ApiWrap::writePreloadedFile(
2699 Data::File &file,
2700 const Data::FileOrigin &origin) {
2701 Expects(_settings != nullptr);
2702
2703 using namespace Output;
2704
2705 if (const auto path = _fileCache->find(file.location)) {
2706 file.relativePath = *path;
2707 return true;
2708 } else if (!file.content.isEmpty()) {
2709 const auto process = prepareFileProcess(file, origin);
2710 if (const auto result = process->file.writeBlock(file.content)) {
2711 file.relativePath = process->relativePath;
2712 _fileCache->save(file.location, file.relativePath);
2713 } else {
2714 ioError(result);
2715 }
2716 return true;
2717 }
2718 return false;
2719}
2720
2721void ApiWrap::loadFile(
2722 const Data::File &file,

Callers

nothing calls this directly

Calls 4

findMethod · 0.45
isEmptyMethod · 0.45
writeBlockMethod · 0.45
saveMethod · 0.45

Tested by

no test coverage detected