update windows + fixes
This commit is contained in:
parent
c33ab763e6
commit
34e6bf52fd
10 changed files with 75 additions and 79 deletions
|
@ -71,16 +71,16 @@ namespace util::error {
|
|||
}
|
||||
}
|
||||
#ifdef _WIN32
|
||||
explicit DraconisError(const winrt::hresult_error& e) : message(winrt::to_string(e.message())) {
|
||||
explicit DracError(const winrt::hresult_error& e) : message(winrt::to_string(e.message())) {
|
||||
switch (e.code()) {
|
||||
case E_ACCESSDENIED: code = DraconisErrorCode::PermissionDenied; break;
|
||||
case E_ACCESSDENIED: code = DracErrorCode::PermissionDenied; break;
|
||||
case HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND):
|
||||
case HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND):
|
||||
case HRESULT_FROM_WIN32(ERROR_SERVICE_NOT_FOUND): code = DraconisErrorCode::NotFound; break;
|
||||
case HRESULT_FROM_WIN32(ERROR_SERVICE_NOT_FOUND): code = DracErrorCode::NotFound; break;
|
||||
case HRESULT_FROM_WIN32(ERROR_TIMEOUT):
|
||||
case HRESULT_FROM_WIN32(ERROR_SEM_TIMEOUT): code = DraconisErrorCode::Timeout; break;
|
||||
case HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED): code = DraconisErrorCode::NotSupported; break;
|
||||
default: code = DraconisErrorCode::PlatformSpecific; break;
|
||||
case HRESULT_FROM_WIN32(ERROR_SEM_TIMEOUT): code = DracErrorCode::Timeout; break;
|
||||
case HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED): code = DracErrorCode::NotSupported; break;
|
||||
default: code = DracErrorCode::PlatformSpecific; break;
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
|
|
@ -27,10 +27,10 @@ namespace util::helpers {
|
|||
const UniquePointer<char, decltype(&free)> ptrManager(rawPtr, free);
|
||||
|
||||
if (err != 0)
|
||||
return Err(DraconisError(DraconisErrorCode::PermissionDenied, "Failed to retrieve environment variable"));
|
||||
return Err(DracError(DracErrorCode::PermissionDenied, "Failed to retrieve environment variable"));
|
||||
|
||||
if (!ptrManager)
|
||||
return Err(DraconisError(DraconisErrorCode::NotFound, "Environment variable not found"));
|
||||
return Err(DracError(DracErrorCode::NotFound, "Environment variable not found"));
|
||||
|
||||
return ptrManager.get();
|
||||
#else
|
||||
|
|
|
@ -156,6 +156,7 @@ namespace util::logging {
|
|||
fn LogImpl(
|
||||
const LogLevel level,
|
||||
#ifndef NDEBUG
|
||||
// ReSharper disable once CppDoxygenUndocumentedParameter
|
||||
const std::source_location& loc,
|
||||
#endif
|
||||
std::format_string<Args...> fmt,
|
||||
|
@ -173,7 +174,7 @@ namespace util::logging {
|
|||
String timestamp;
|
||||
|
||||
#ifdef _WIN32
|
||||
if (localtime_s(&local_tm, &now_tt) == 0) {
|
||||
if (localtime_s(&localTm, &nowTt) == 0) {
|
||||
#else
|
||||
if (localtime_r(&nowTt, &localTm) != nullptr) {
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue