MCPcopy Create free account
hub / github.com/davidgiven/fluxengine / putFile

Method putFile

lib/vfs/fatfs.cc:162–184  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

160 }
161
162 void putFile(const Path& path, const Bytes& bytes) override
163 {
164 mount();
165 auto pathstr = toUpper(path.to_str());
166 FIL fil;
167 FRESULT res =
168 f_open(&fil, pathstr.c_str(), FA_WRITE | FA_CREATE_ALWAYS);
169 throwError(res);
170
171 unsigned remaining = bytes.size();
172 char* ptr = (char*)bytes.cbegin();
173 while (remaining != 0)
174 {
175 UINT done;
176 res = f_write(&fil, ptr, remaining, &done);
177 throwError(res);
178
179 remaining -= done;
180 ptr += done;
181 }
182
183 f_close(&fil);
184 }
185
186 void deleteFile(const Path& path) override
187 {

Callers

nothing calls this directly

Calls 4

toUpperFunction · 0.85
to_strMethod · 0.80
cbeginMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected