#1545: Merge partition space information methods from develop

This commit is contained in:
Günter Obiltschnig
2018-03-06 18:46:48 +01:00
parent 0d3c3ce4d4
commit 3f75fd539f
12 changed files with 230 additions and 0 deletions

View File

@@ -380,6 +380,39 @@ bool FileImpl::createDirectoryImpl()
}
FileImpl::FileSizeImpl FileImpl::totalSpaceImpl() const
{
poco_assert(!_path.empty());
ULARGE_INTEGER space;
if (!GetDiskFreeSpaceExA(_path.c_str(), NULL, &space, NULL))
handleLastErrorImpl(_path);
return space.QuadPart;
}
FileImpl::FileSizeImpl FileImpl::usableSpaceImpl() const
{
poco_assert(!_path.empty());
ULARGE_INTEGER space;
if (!GetDiskFreeSpaceExA(upath.c_str(), &space, NULL, NULL))
handleLastErrorImpl(_path);
return space.QuadPart;
}
FileImpl::FileSizeImpl FileImpl::freeSpaceImpl() const
{
poco_assert(!_path.empty());
ULARGE_INTEGER space;
if (!GetDiskFreeSpaceExA(_path.c_str(), NULL, NULL, &space))
handleLastErrorImpl(_path);
return space.QuadPart;
}
void FileImpl::handleLastErrorImpl(const std::string& path)
{
DWORD err = GetLastError();