[Issue 16487] Add function to obtain the available disk space

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Sep 13 03:35:58 PDT 2016


https://issues.dlang.org/show_bug.cgi?id=16487

b2.temp at gmx.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |b2.temp at gmx.com

--- Comment #6 from b2.temp at gmx.com ---
(In reply to Johan Engelen from comment #5)
> (In reply to b2.temp from comment #4)
> > 2. returns -1 on failure. ulong.max: No way !!!
> 
> The return type is _unsigned_.

Oops, sorry , i must be blind ^^

Anyway...Wouldn't 0 be a possible return type in case of error ? 
It would allow:

if (auto space = getAvailableDiskSpace(root))
{
}
else
{
    throw new Exception("either the disk is full or inaccessible");
}

> Throwing an exception is also a possibility.

No, seriously, delegate this option to the user.

--


More information about the Digitalmars-d-bugs mailing list