Fix a fatal bug with first-run that prevents channel list saving

git-svn-id: svn://svn.berlios.de/gpodder/trunk@476 b0d088ad-0a06-0410-aad2-9ed5178a7e87
This commit is contained in:
Thomas Perl 2007-12-01 14:20:57 +00:00
parent 3259c76d5c
commit d2207f2c71
2 changed files with 15 additions and 0 deletions

View File

@ -1,3 +1,10 @@
Sat, 01 Dec 2007 15:19:29 +0100 <thp@perli.net>
Fix a fatal bug with first-run that prevents channel list saving
* src/gpodder/util.py: Always use a file's parent directory to get the
free disk space and return zero free disk space when the parent
directory does not exist
Thu, 29 Nov 2007 08:53:36 +0100 <thp@perli.net>
Support for itpc:// URLs

View File

@ -142,7 +142,15 @@ def get_free_disk_space(path):
"""
Calculates the free disk space available to the current user
on the file system that contains the given path.
If the path (or its parent folder) does not yet exist, this
function returns zero.
"""
path = os.path.dirname(path)
if not os.path.exists(path):
return 0
s = os.statvfs(path)
return s.f_bavail * s.f_bsize