Fix free space check in Windows

This commit is contained in:
Andrew Resch 2009-04-25 07:24:58 +00:00
parent 587d9a7e5f
commit 127b58c36d
2 changed files with 4 additions and 4 deletions

View file

@ -13,6 +13,7 @@
==== Windows ====
* Fix freezing in create torrent dialog
* Fix creating torrents in Windows
* Fix free space check
=== Deluge 1.1.6 - (06 April 2009) ===
==== Core ====

View file

@ -452,10 +452,9 @@ def free_space(path):
"""
if windows_check():
import win32api
drive = path.split(":")[0]
free = win32api.GetDiskFreeSpaceEx(drive)[0]
return free
import win32file
sectors, bytes, free, total = map(long, win32file.GetDiskFreeSpace(path))
return (free * sectors * bytes)
else:
disk_data = os.statvfs(path)
block_size = disk_data.f_bsize