delete a file on common OS and report failure absolute filename to delete message type on failure
| 295 | /// <param name="filename">absolute filename to delete</param> |
| 296 | /// <param name="onFailMsg">message type on failure</param> |
| 297 | void 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!! |
no test coverage detected