Added NzInputStream

Added NzFile::Read(buffer, size)
NzFile::Read(nullptr, size) now acts as a skip function (ex: SetCursorPos(GetCursorPos() + size)
This commit is contained in:
Lynix
2012-05-15 13:26:35 +02:00
parent 182bd4cffe
commit cef402c8a5
17 changed files with 101 additions and 49 deletions

View File

@@ -151,19 +151,15 @@ bool NzFileImpl::Copy(const NzString& sourcePath, const NzString& targetPath)
{
wchar_t* path = sourcePath.GetWideBuffer();
wchar_t* newPath = targetPath.GetWideBuffer();
bool success = CopyFileW(path, newPath, false);
delete[] path;
delete[] newPath;
if (CopyFileW(path, newPath, false))
{
delete[] path;
delete[] newPath;
if (success)
return true;
}
else
{
NazaraError("Unable to copy file: " + NzGetLastSystemError());
delete[] path;
delete[] newPath;
return false;
}
@@ -172,17 +168,14 @@ bool NzFileImpl::Copy(const NzString& sourcePath, const NzString& targetPath)
bool NzFileImpl::Delete(const NzString& filePath)
{
wchar_t* path = filePath.GetWideBuffer();
bool success = DeleteFileW(path);
delete[] path;
if (DeleteFileW(path))
{
delete[] path;
if (success)
return true;
}
else
{
NazaraError("Unable to delete file (" + filePath + "): " + NzGetLastSystemError());
delete[] path;
return false;
}

View File

@@ -3,6 +3,7 @@
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Core/Win32/SemaphoreImpl.hpp>
#include <Nazara/Core/Config.hpp>
#include <Nazara/Core/Error.hpp>
#include <limits>
#include <Nazara/Core/Debug.hpp>