MCPcopy Create free account
hub / github.com/apache/arrow / DeleteFile

Function DeleteFile

cpp/src/arrow/util/io_util.cc:959–980  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

957}
958
959Result<bool> DeleteFile(const PlatformFilename& file_path, bool allow_not_found) {
960#ifdef _WIN32
961 if (DeleteFileW(file_path.ToNative().c_str())) {
962 return true;
963 } else {
964 int errnum = GetLastError();
965 if (!allow_not_found || errnum != ERROR_FILE_NOT_FOUND) {
966 return IOErrorFromWinError(GetLastError(), "Cannot delete file '",
967 file_path.ToString(), "'");
968 }
969 }
970#else
971 if (unlink(file_path.ToNative().c_str()) == 0) {
972 return true;
973 } else {
974 if (!allow_not_found || errno != ENOENT) {
975 return IOErrorFromErrno(errno, "Cannot delete file '", file_path.ToString(), "'");
976 }
977 }
978#endif
979 return false;
980}
981
982Result<bool> FileExists(const PlatformFilename& path) {
983#ifdef _WIN32

Callers 4

DeleteFileMethod · 0.85
DeleteFilesMethod · 0.85
MoveMethod · 0.85
TESTFunction · 0.85

Calls 3

IOErrorFromWinErrorFunction · 0.85
IOErrorFromErrnoFunction · 0.85
ToStringMethod · 0.45

Tested by 1

TESTFunction · 0.68