Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[update-app] fix for getting disk space

Signed-off-by: Christopher Hall <hsw@openmoko.com>
  • Loading branch information...
commit c2bf7639d289328ec976be751084251c4609c7d8 1 parent 128ddab
@hxw hxw authored
Showing with 22 additions and 22 deletions.
  1. +22 −22 update-app/winapi.py
View
44 update-app/winapi.py
@@ -2,25 +2,25 @@
This API only for MSW(Windows) version.
"""
-import wmi
-
-c = wmi.WMI()
-
-def getRemovableDisk():
- tmp = []
- disk = []
- for drive in c.Win32_LogicalDisk(DriveType=2):
- tmp.append(str(drive.Caption))
-
- for physical_disk in c.Win32_DiskDrive():
- if physical_disk.size:
- for partition in physical_disk.associators ("Win32_DiskDriveToDiskPartition"):
- for logical_disk in partition.associators ("Win32_LogicalDiskToPartition"):
- if logical_disk.Caption in tmp:
- disk.append(str(logical_disk.Caption))
-
- return disk
-
-def getDiskSize(DeviceID):
- disk = c.Win32_LogicalDisk(DeviceID="G:")[0]
- return disk.size, disk.Freespace
+import wmi
+
+c = wmi.WMI()
+
+def getRemovableDisk():
+ tmp = []
+ disk = []
+ for drive in c.Win32_LogicalDisk(DriveType=2):
+ tmp.append(str(drive.Caption))
+
+ for physical_disk in c.Win32_DiskDrive():
+ if physical_disk.size:
+ for partition in physical_disk.associators ("Win32_DiskDriveToDiskPartition"):
+ for logical_disk in partition.associators ("Win32_LogicalDiskToPartition"):
+ if logical_disk.Caption in tmp:
+ disk.append(str(logical_disk.Caption))
+
+ return disk
+
+def getDiskSize(DeviceID="G:"):
+ disk = c.Win32_LogicalDisk(DeviceID=DeviceID)[0]
+ return disk.size, disk.Freespace
Please sign in to comment.
Something went wrong with that request. Please try again.