MCPcopy Create free account
hub / github.com/LAStools/LAStools / FileDelete

Function FileDelete

LASzip/src/mydefs.cpp:297–307  ·  view source on GitHub ↗

delete a file on common OS and report failure absolute filename to delete message type on failure

Source from the content-addressed store, hash-verified

295/// <param name="filename">absolute filename to delete</param>
296/// <param name="onFailMsg">message type on failure</param>
297void FileDelete(std::filesystem::path file, LAS_MESSAGE_TYPE onFailMsg) {
298 if (file.string().empty()) return;
299 LASMessage(LAS_VERBOSE, "deleting '%s'", file.string().c_str());
300 try {
301 if (!std::filesystem::remove(file)) {
302 LASMessage(LAS_WARNING, "file not found: '%s'", file.string().c_str());
303 }
304 } catch (const std::filesystem::filesystem_error& e) {
305 LASMessage(onFailMsg, "delete of file '%s' failed [%s]", file.string().c_str(), e.what());
306 }
307}
308
309/// !!The caller is responsible for managing the memory of the returned const char*
310/// using 'delete[]' when done!!

Callers 1

runMethod · 0.85

Calls 4

LASMessageFunction · 0.85
emptyMethod · 0.80
whatMethod · 0.80
stringMethod · 0.45

Tested by

no test coverage detected