Commit 01c3efb8 by rfkelly0

added "total_space" meta value to OSFS

parent eb2dbaaa
...@@ -176,6 +176,19 @@ class OSFS(OSFSXAttrMixin, OSFSWatchMixin, FS): ...@@ -176,6 +176,19 @@ class OSFS(OSFSXAttrMixin, OSFSWatchMixin, FS):
else: else:
stat = os.statvfs(self.root_path) stat = os.statvfs(self.root_path)
return stat.f_bfree * stat.f_bsize return stat.f_bfree * stat.f_bsize
elif meta_name == 'total_space':
if platform.system() == 'Windows':
try:
import ctypes
total_bytes = ctypes.ulonglong(0)
ctypes.windll.kernel32.GetDiskFreeSpaceExW(ctypes.c_wchar_p(self.root_path), None, ctypes.pointer(total_bytes), None)
return total_bytes.value
except ImportError:
# Fall through to call the base class
pass
else:
stat = os.statvfs(self.root_path)
return stat.f_blocks * stat.f_bsize
return super(OSFS, self).getmeta(meta_name, default) return super(OSFS, self).getmeta(meta_name, default)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment