MCPcopy Create free account
hub / github.com/Tencent/libpag / CopyFile

Function CopyFile

exporter/src/utils/FileHelper.cpp:80–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78}
79
80bool CopyFile(const std::string& src, const std::string& dst) {
81 try {
82 auto srcPath = Utf8ToPath(src);
83 if (!fs::exists(srcPath)) {
84 return false;
85 }
86 auto dstPath = Utf8ToPath(dst);
87 auto parentPath = dstPath.parent_path();
88 if (!parentPath.empty() && !fs::exists(parentPath)) {
89 fs::create_directories(parentPath);
90 }
91 fs::copy_file(srcPath, dstPath, fs::copy_options::overwrite_existing);
92 return true;
93 } catch (...) {
94 return false;
95 }
96}
97
98bool WriteToFile(const std::string& filePath, const char* data, std::streamsize size,
99 std::ios::openmode mode) {

Callers 1

ParseTextDocumentFunction · 0.85

Calls 2

emptyMethod · 0.80
Utf8ToPathFunction · 0.50

Tested by

no test coverage detected