Fix free space check in Windows

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

View file

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

View file

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