endif()
if(WIN32)
- list(APPEND source_files win32compat.cpp)
+ list(APPEND source_files Win32Util.cpp)
endif()
add_library(ccache_lib STATIC ${source_files})
#include "logging.hpp"
#ifdef _WIN32
-# include "win32compat.hpp"
+# include "Win32Util.hpp"
#endif
#include "third_party/fmt/core.h"
DWORD error = GetLastError();
cc_log("lockfile_acquire: CreateFile %s: %s (%lu)",
lockfile.c_str(),
- win32_error_message(error).c_str(),
+ Win32Util::error_message(error).c_str(),
error);
if (error == ERROR_PATH_NOT_FOUND) {
// Directory doesn't exist?
# include <sys/param.h>
#endif
-#ifdef _WIN32
-# include "win32compat.hpp"
-#endif
-
#ifdef __linux__
# ifdef HAVE_SYS_IOCTL_H
# include <sys/ioctl.h>
// this program; if not, write to the Free Software Foundation, Inc., 51
// Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-#include "win32compat.hpp"
+#include "Win32Util.hpp"
-#ifdef _WIN32
+namespace Win32Util {
std::string
-win32_error_message(DWORD error_code)
+error_message(DWORD error_code)
{
LPSTR buffer;
size_t size =
return message;
}
-#endif
+} // namespace Win32Util
#include <string>
-std::string win32_error_message(DWORD error_code);
+namespace Win32Util {
-BOOL
-GetFileNameFromHandle(HANDLE file_handle, TCHAR* filename, WORD cch_filename);
+std::string error_message(DWORD error_code);
+
+} // namespace Win32Util
#include "logging.hpp"
#ifdef _WIN32
-# include "win32compat.hpp"
+# include "Win32Util.hpp"
#endif
using nonstd::string_view;
free(args);
if (ret == 0) {
DWORD error = GetLastError();
- std::string error_message = win32_error_message(error);
cc_log("failed to execute %s: %s (%lu)",
full_path_win_ext,
- win32_error_message(error).c_str(),
+ Win32Util::error_message(error).c_str(),
error);
return -1;
}
#include "logging.hpp"
#ifdef _WIN32
-# include "win32compat.hpp"
+# include "Win32Util.hpp"
#endif
#ifdef HAVE_PWD_H
cc_log("failed to rename %s to %s: %s (%lu)",
oldpath,
newpath,
- win32_error_message(error).c_str(),
+ Win32Util::error_message(error).c_str(),
error);
return -1;
} else {