diff --git a/test/osal-unix.cc b/test/osal-unix.cc index 6661ae42..1856d0f8 100644 --- a/test/osal-unix.cc +++ b/test/osal-unix.cc @@ -1,4 +1,4 @@ -/* +/* * Copyright 2017-2018 Leonid Yuriev * and other libmdbx authors: please see AUTHORS file. * All rights reserved. @@ -301,3 +301,7 @@ std::string osal_tempdir(void) { return "/dev/shm/"; return ""; } + +int osal_removefile(const std::string &pathname) { + return unlink(pathname.c_str()) ? errno : MDBX_SUCCESS; +} diff --git a/test/osal-windows.cc b/test/osal-windows.cc index 7d59f657..f7f1de56 100644 --- a/test/osal-windows.cc +++ b/test/osal-windows.cc @@ -1,4 +1,4 @@ -/* +/* * Copyright 2017-2018 Leonid Yuriev * and other libmdbx authors: please see AUTHORS file. * All rights reserved. @@ -405,3 +405,7 @@ std::string osal_tempdir(void) { DWORD len = GetTempPathA(sizeof(buf), buf); return std::string(buf, len); } + +int osal_removefile(const std::string &pathname) { + return DeleteFileA(pathname.c_str()) ? MDBX_SUCCESS : GetLastError(); +} diff --git a/test/osal.h b/test/osal.h index c27282a6..3ccc7bbe 100644 --- a/test/osal.h +++ b/test/osal.h @@ -1,4 +1,4 @@ -/* +/* * Copyright 2017-2018 Leonid Yuriev * and other libmdbx authors: please see AUTHORS file. * All rights reserved. @@ -32,6 +32,7 @@ void osal_udelay(unsigned us); void osal_yield(void); bool osal_istty(int fd); std::string osal_tempdir(void); +int osal_removefile(const std::string &pathname); #ifdef _MSC_VER #ifndef STDIN_FILENO