調べたのでメモ。
/**
容量取得
- 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)
}
}