diff --git a/src/osal.c b/src/osal.c index 37a9c2d3..c2fced0b 100644 --- a/src/osal.c +++ b/src/osal.c @@ -408,6 +408,13 @@ int mdbx_fastmutex_release(mdbx_fastmutex_t *fastmutex) { /*----------------------------------------------------------------------------*/ +int mdbx_removefile(const char *pathname) { +#if defined(_WIN32) || defined(_WIN64) + return DeleteFileA(pathname) ? MDBX_SUCCESS : GetLastError(); +#else + return unlink(pathname) ? errno : MDBX_SUCCESS; +#endif +} int mdbx_openfile(const char *pathname, int flags, mode_t mode, mdbx_filehandle_t *fd, bool exclusive) { *fd = INVALID_HANDLE_VALUE; diff --git a/src/osal.h b/src/osal.h index 5c74fd93..daa79064 100644 --- a/src/osal.h +++ b/src/osal.h @@ -479,6 +479,7 @@ int mdbx_filesize(mdbx_filehandle_t fd, uint64_t *length); int mdbx_openfile(const char *pathname, int flags, mode_t mode, mdbx_filehandle_t *fd, bool exclusive); int mdbx_closefile(mdbx_filehandle_t fd); +int mdbx_removefile(const char *pathname); typedef struct mdbx_mmap_param { union {