summaryrefslogtreecommitdiffstats
path: root/pyload/utils
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@gmail.com> 2013-10-05 18:10:49 +0200
committerGravatar Walter Purcaro <vuolter@gmail.com> 2013-10-05 18:10:49 +0200
commit3d35f842aeec225688a2923f394fa167e8977011 (patch)
tree86dc44faf7dc1475c69a724b353e4da747555832 /pyload/utils
parentAdded fs_bsize method to utils (diff)
downloadpyload-3d35f842aeec225688a2923f394fa167e8977011.tar.xz
Put ctypes under if condition
Diffstat (limited to 'pyload/utils')
-rw-r--r--pyload/utils/fs.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/pyload/utils/fs.py b/pyload/utils/fs.py
index bffb23016..56f76c490 100644
--- a/pyload/utils/fs.py
+++ b/pyload/utils/fs.py
@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
-import ctypes
import os
import sys
from os.path import join
@@ -67,6 +66,8 @@ def free_space(folder):
folder = fs_encode(folder)
if os.name == "nt":
+ import ctypes
+
free_bytes = ctypes.c_ulonglong(0)
ctypes.windll.kernel32.GetDiskFreeSpaceExW(ctypes.c_wchar_p(folder), None, None, ctypes.pointer(free_bytes))
return free_bytes.value
@@ -78,6 +79,8 @@ def fs_bsize(path):
path = fs_encode(path)
if os.name == "nt":
+ import ctypes
+
drive = "%s\\" % os.path.splitdrive(path)[0]
cluster_sectors, sector_size = ctypes.c_longlong(0)
ctypes.windll.kernel32.GetDiskFreeSpaceW(ctypes.c_wchar_p(drive), ctypes.pointer(cluster_sectors), ctypes.pointer(sector_size), None, None)