Improved Error system
Former-commit-id: ddd08841d30575713f4a28ac02566f92791e5539
This commit is contained in:
@@ -52,7 +52,7 @@ bool NzDirectoryImpl::NextResult()
|
||||
else
|
||||
{
|
||||
if (GetLastError() != ERROR_NO_MORE_FILES)
|
||||
NazaraError("Unable to get next result: " + NzGetLastSystemError());
|
||||
NazaraError("Unable to get next result: " + NzError::GetLastSystemError());
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -67,7 +67,7 @@ bool NzDirectoryImpl::Open(const NzString& dirPath)
|
||||
|
||||
if (m_handle == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
NazaraError("Unable to open directory: " + NzGetLastSystemError());
|
||||
NazaraError("Unable to open directory: " + NzError::GetLastSystemError());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -106,10 +106,10 @@ NzString NzDirectoryImpl::GetCurrent()
|
||||
if (GetCurrentDirectoryW(size, path.get()) != 0)
|
||||
currentPath = NzString::Unicode(path.get());
|
||||
else
|
||||
NazaraError("Unable to get current directory: " + NzGetLastSystemError());
|
||||
NazaraError("Unable to get current directory: " + NzError::GetLastSystemError());
|
||||
}
|
||||
else if (size == 0)
|
||||
NazaraError("Unable to get current directory: " + NzGetLastSystemError());
|
||||
NazaraError("Unable to get current directory: " + NzError::GetLastSystemError());
|
||||
else
|
||||
currentPath = NzString::Unicode(path.get());
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ NzDynLibFunc NzDynLibImpl::GetSymbol(const NzString& symbol) const
|
||||
{
|
||||
NzDynLibFunc sym = reinterpret_cast<NzDynLibFunc>(GetProcAddress(m_handle, symbol.GetConstBuffer()));
|
||||
if (!sym)
|
||||
m_parent->SetLastError(NzGetLastSystemError());
|
||||
m_parent->SetLastError(NzError::GetLastSystemError());
|
||||
|
||||
return sym;
|
||||
}
|
||||
@@ -36,7 +36,7 @@ bool NzDynLibImpl::Load(const NzString& libraryPath)
|
||||
return true;
|
||||
else
|
||||
{
|
||||
m_parent->SetLastError(NzGetLastSystemError());
|
||||
m_parent->SetLastError(NzError::GetLastSystemError());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ bool NzFileImpl::EndOfFile() const
|
||||
void NzFileImpl::Flush()
|
||||
{
|
||||
if (!FlushFileBuffers(m_handle))
|
||||
NazaraError("Unable to flush file: " + NzGetLastSystemError());
|
||||
NazaraError("Unable to flush file: " + NzError::GetLastSystemError());
|
||||
}
|
||||
|
||||
nzUInt64 NzFileImpl::GetCursorPos() const
|
||||
@@ -191,7 +191,7 @@ bool NzFileImpl::Copy(const NzString& sourcePath, const NzString& targetPath)
|
||||
return true;
|
||||
else
|
||||
{
|
||||
NazaraError("Failed to copy file: " + NzGetLastSystemError());
|
||||
NazaraError("Failed to copy file: " + NzError::GetLastSystemError());
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -205,7 +205,7 @@ bool NzFileImpl::Delete(const NzString& filePath)
|
||||
return true;
|
||||
else
|
||||
{
|
||||
NazaraError("Failed to delete file (" + filePath + "): " + NzGetLastSystemError());
|
||||
NazaraError("Failed to delete file (" + filePath + "): " + NzError::GetLastSystemError());
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -235,7 +235,7 @@ time_t NzFileImpl::GetCreationTime(const NzString& filePath)
|
||||
FILETIME creationTime;
|
||||
if (!GetFileTime(handle, &creationTime, nullptr, nullptr))
|
||||
{
|
||||
NazaraError("Unable to get creation time: " + NzGetLastSystemError());
|
||||
NazaraError("Unable to get creation time: " + NzError::GetLastSystemError());
|
||||
|
||||
CloseHandle(handle);
|
||||
return 0;
|
||||
@@ -257,7 +257,7 @@ time_t NzFileImpl::GetLastAccessTime(const NzString& filePath)
|
||||
FILETIME accessTime;
|
||||
if (!GetFileTime(handle, nullptr, &accessTime, nullptr))
|
||||
{
|
||||
NazaraError("Unable to get last access time: " + NzGetLastSystemError());
|
||||
NazaraError("Unable to get last access time: " + NzError::GetLastSystemError());
|
||||
|
||||
CloseHandle(handle);
|
||||
return 0;
|
||||
@@ -279,7 +279,7 @@ time_t NzFileImpl::GetLastWriteTime(const NzString& filePath)
|
||||
FILETIME writeTime;
|
||||
if (!GetFileTime(handle, nullptr, nullptr, &writeTime))
|
||||
{
|
||||
NazaraError("Unable to get last write time: " + NzGetLastSystemError());
|
||||
NazaraError("Unable to get last write time: " + NzError::GetLastSystemError());
|
||||
CloseHandle(handle);
|
||||
|
||||
return 0;
|
||||
@@ -316,7 +316,7 @@ bool NzFileImpl::Rename(const NzString& sourcePath, const NzString& targetPath)
|
||||
return true;
|
||||
else
|
||||
{
|
||||
NazaraError("Unable to rename file: " + NzGetLastSystemError());
|
||||
NazaraError("Unable to rename file: " + NzError::GetLastSystemError());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ NzSemaphoreImpl::NzSemaphoreImpl(unsigned int count)
|
||||
{
|
||||
m_semaphore = CreateSemaphore(nullptr, count, std::numeric_limits<LONG>::max(), nullptr);
|
||||
if (!m_semaphore)
|
||||
NazaraError("Failed to create semaphore: " + NzGetLastSystemError());
|
||||
NazaraError("Failed to create semaphore: " + NzError::GetLastSystemError());
|
||||
}
|
||||
|
||||
NzSemaphoreImpl::~NzSemaphoreImpl()
|
||||
@@ -31,7 +31,7 @@ void NzSemaphoreImpl::Post()
|
||||
{
|
||||
#if NAZARA_CORE_SAFE
|
||||
if (!ReleaseSemaphore(m_semaphore, 1, nullptr))
|
||||
NazaraError("Failed to release semaphore: " + NzGetLastSystemError());
|
||||
NazaraError("Failed to release semaphore: " + NzError::GetLastSystemError());
|
||||
#else
|
||||
ReleaseSemaphore(m_semaphore, 1, nullptr);
|
||||
#endif
|
||||
@@ -41,7 +41,7 @@ void NzSemaphoreImpl::Wait()
|
||||
{
|
||||
#if NAZARA_CORE_SAFE
|
||||
if (WaitForSingleObject(m_semaphore, INFINITE) == WAIT_FAILED)
|
||||
NazaraError("Failed to wait for semaphore: " + NzGetLastSystemError());
|
||||
NazaraError("Failed to wait for semaphore: " + NzError::GetLastSystemError());
|
||||
#else
|
||||
WaitForSingleObject(m_semaphore, INFINITE);
|
||||
#endif
|
||||
@@ -53,7 +53,7 @@ bool NzSemaphoreImpl::Wait(nzUInt32 timeout)
|
||||
DWORD result = WaitForSingleObject(m_semaphore, timeout);
|
||||
if (result == WAIT_FAILED)
|
||||
{
|
||||
NazaraError("Failed to wait for semaphore: " + NzGetLastSystemError());
|
||||
NazaraError("Failed to wait for semaphore: " + NzError::GetLastSystemError());
|
||||
return false;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -12,7 +12,7 @@ NzThreadImpl::NzThreadImpl(NzFunctor* functor)
|
||||
{
|
||||
m_handle = reinterpret_cast<HANDLE>(_beginthreadex(nullptr, 0, &NzThreadImpl::ThreadProc, functor, 0, nullptr));
|
||||
if (!m_handle)
|
||||
NazaraInternalError("Failed to create thread: " + NzGetLastSystemError());
|
||||
NazaraInternalError("Failed to create thread: " + NzError::GetLastSystemError());
|
||||
}
|
||||
|
||||
void NzThreadImpl::Detach()
|
||||
|
||||
Reference in New Issue
Block a user