list(APPEND source_files MiniTrace.cpp)
endif()
-if(WIN32)
- list(APPEND source_files Win32Util.cpp)
-else()
+if(NOT WIN32)
list(APPEND source_files SignalHandler.cpp)
endif()
#include "Util.hpp"
#include "hashutil.hpp"
-#include <Win32Util.hpp>
#include <util/TimePoint.hpp>
#include <util/file.hpp>
#include <util/path.hpp>
#include "Config.hpp"
#include "Util.hpp"
-#include "Win32Util.hpp"
#include "execute.hpp"
#include <util/FileStream.hpp>
#include "Config.hpp"
#include "Context.hpp"
#include "Logging.hpp"
-#include "Win32Util.hpp"
#include <Config.hpp>
#include <core/exceptions.hpp>
#include "MiniTrace.hpp"
#include "SignalHandler.hpp"
#include "Util.hpp"
-#include "Win32Util.hpp"
#include "argprocessing.hpp"
#include "compopt.hpp"
#include "execute.hpp"
#include "Logging.hpp"
#include "SignalHandler.hpp"
#include "Util.hpp"
-#include "Win32Util.hpp"
#include <ccache.hpp>
#include <core/exceptions.hpp>
#include <util/Fd.hpp>
#include <util/Finalizer.hpp>
#include <util/TemporaryFile.hpp>
+#include <util/error.hpp>
#include <util/expected.hpp>
#include <util/file.hpp>
#include <util/filesystem.hpp>
if (!job_success) {
DWORD error = GetLastError();
LOG("failed to IsProcessInJob: {} ({})",
- Win32Util::error_message(error),
+ util::win32_error_message(error),
error);
return 0;
}
if (!querySuccess) {
DWORD error = GetLastError();
LOG("failed to QueryInformationJobObject: {} ({})",
- Win32Util::error_message(error),
+ util::win32_error_message(error),
error);
return 0;
}
if (job == nullptr) {
DWORD error = GetLastError();
LOG("failed to CreateJobObject: {} ({})",
- Win32Util::error_message(error),
+ util::win32_error_message(error),
error);
return -1;
}
if (!job_success) {
DWORD error = GetLastError();
LOG("failed to JobObjectExtendedLimitInformation: {} ({})",
- Win32Util::error_message(error),
+ util::win32_error_message(error),
error);
return -1;
}
DWORD error = GetLastError();
LOG("failed to execute {}: {} ({})",
full_path,
- Win32Util::error_message(error),
+ util::win32_error_message(error),
error);
return -1;
}
DWORD error = GetLastError();
LOG("failed to assign process to job object {}: {} ({})",
full_path,
- Win32Util::error_message(error),
+ util::win32_error_message(error),
error);
return -1;
}
#include "Config.hpp"
#include "Context.hpp"
#include "Logging.hpp"
-#include "Win32Util.hpp"
#include "execute.hpp"
#include "macroskip.hpp"
UmaskScope.cpp
assertions.cpp
environment.cpp
+ error.cpp
file.cpp
filesystem.cpp
path.cpp
#include "DirEntry.hpp"
#include <Logging.hpp>
-#include <Win32Util.hpp>
#include <util/Finalizer.hpp>
#include <util/file.hpp>
#include <util/fmtmacros.hpp>
#include "Logging.hpp"
#include "Util.hpp"
-#include "Win32Util.hpp"
#include <util/DirEntry.hpp>
#include <util/assertions.hpp>
+#include <util/error.hpp>
#include <util/file.hpp>
#include <util/filesystem.hpp>
#include <util/fmtmacros.hpp>
LOG("Could not acquire {}: {} ({})",
m_lock_file,
- Win32Util::error_message(error),
+ util::win32_error_message(error),
error);
// ERROR_SHARING_VIOLATION: lock already held.
// this program; if not, write to the Free Software Foundation, Inc., 51
// Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-#include "Win32Util.hpp"
+#include "error.hpp"
-#include "Util.hpp"
+#include <util/wincompat.hpp>
-#include <util/string.hpp>
+namespace util {
-#include <chrono>
-#include <thread>
-
-namespace Win32Util {
+#ifdef _WIN32
std::string
-error_message(DWORD error_code)
+win32_error_message(uint32_t error_code)
{
LPSTR buffer;
size_t size =
return message;
}
-} // namespace Win32Util
+#endif
+
+} // namespace util
-// Copyright (C) 2020-2023 Joel Rosdahl and other contributors
+// Copyright (C) 2023 Joel Rosdahl and other contributors
//
// See doc/AUTHORS.adoc for a complete list of contributors.
//
#pragma once
-#ifdef _WIN32
-
-# include <util/wincompat.hpp>
+#include <cstdint>
+#include <string>
-# include <string>
+namespace util {
-namespace Win32Util {
+#ifdef _WIN32
// Return the error message corresponding to `error_code`.
-std::string error_message(DWORD error_code);
-
-} // namespace Win32Util
+std::string win32_error_message(uint32_t error_code);
#endif
+
+} // namespace util
#include "file.hpp"
#include <Logging.hpp>
-#include <Win32Util.hpp>
#include <util/Bytes.hpp>
#include <util/DirEntry.hpp>
#include <util/Fd.hpp>
#include <util/Finalizer.hpp>
#include <util/TemporaryFile.hpp>
+#include <util/error.hpp>
#include <util/expected.hpp>
#include <util/file.hpp>
#include <util/filesystem.hpp>
return tl::unexpected(
FMT("Failed to convert {} from UTF-16LE to UTF-8: {}",
path,
- Win32Util::error_message(GetLastError())));
+ util::win32_error_message(GetLastError())));
}
result = std::string(size, '\0');