MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / copy

Method copy

source/core/StarFile.cpp:36–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34}
35
36void File::copy(String const& source, String const& target) {
37 auto sourceFile = File::open(source, IOMode::Read);
38 auto targetFile = File::open(target, IOMode::ReadWrite);
39
40 targetFile->resize(0);
41
42 char buf[1024];
43 while (!sourceFile->atEnd()) {
44 size_t r = sourceFile->read(buf, 1024);
45 targetFile->writeFull(buf, r);
46 }
47}
48
49FilePtr File::open(const String& filename, IOMode mode) {
50 auto file = make_shared<File>(filename);

Callers

nothing calls this directly

Calls 4

writeFullMethod · 0.80
resizeMethod · 0.45
atEndMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected