由于项目中要用到读取插入U盘的可用容量,并往里面写数据,所以记录一下获取可用容量的方法。
var filesystemFreeSize: Int64? {
return try? FileManager.default.attributesOfFileSystem(forPath: path)[.systemFreeSize] as? Int64
}
path为用户点击授权之后的路径。m
由于项目中要用到读取插入U盘的可用容量,并往里面写数据,所以记录一下获取可用容量的方法。
var filesystemFreeSize: Int64? {
return try? FileManager.default.attributesOfFileSystem(forPath: path)[.systemFreeSize] as? Int64
}
path为用户点击授权之后的路径。m