Affects Version/s: 1.1
Fix Version/s: 1.2
Operating System: Linux
Re: Commons-IO class FileSystemUtils
The method freeSpace(String path) returns free disk space in bytes on Windows,
and returns free disk space in kilobytes (not bytes) on Linux (possibly Unix /
Mac OS etc. also).
The internal method freeSpaceUnix javadoc reads "Find free space on the *nix
platform using the 'df' command." The value returned by df is read in to a
variable called bytes and returned. Man pages for df on Linux (Fedora Core 4)
read "Disk space is shown in 1K blocks by default". So method
freeSpaceUnix is returning the number of kilobytes free space, not bytes.
A simple fix could be to add line "bytes = bytes * 1024;" after bytes are read in.
The javadocs for this class could be improved also. Comment "@return the amount
of free drive space on the volume" could read "@return the amount of free drive
space on the volume in bytes".