Skip to content

Instantly share code, notes, and snippets.

@MTattin
Created April 30, 2016 23:29
Show Gist options
  • Save MTattin/04ca42131f37f65177e447d44947100e to your computer and use it in GitHub Desktop.
Save MTattin/04ca42131f37f65177e447d44947100e to your computer and use it in GitHub Desktop.
/**
容量取得
- returns: freeとtotalのサイズ取得
*/
static func GetDiskSize() -> (free: Double?, total: Double?) {
let _0_paths: NSArray = NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory.LibraryDirectory, NSSearchPathDomainMask.UserDomainMask, true)
let _0_last: String = _0_paths.lastObject as! String
do {
let _0_dic: NSDictionary = try NSFileManager.defaultManager().attributesOfFileSystemForPath(_0_last)
return (
(_0_dic[NSFileSystemFreeSize] as! NSNumber).doubleValue,
(_0_dic[NSFileSystemSize] as! NSNumber).doubleValue
)
} catch let e as NSError {
print("error : \(e.localizedDescription)")
return (nil, nil)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment