部分需求修改

This commit is contained in:
DDIsFriend
2023-10-24 10:09:59 +08:00
parent 529d44d51d
commit c11aab7e05
45 changed files with 8039 additions and 8542 deletions

View File

@@ -0,0 +1,62 @@
//
// DDFileManager.swift
// DDUtilsSwiftKit_Private
// Created by DDIsFriend on 2023/10/10.
import Foundation
public let DDFM = DDFileManager.default
open class DDFileManager {
public static let `default` = DDFileManager()
public func calculateFile(filePath:String) -> Float {
///
let fileArr = FileManager.default.subpaths(atPath: filePath)
var size: Float = 0
for file in fileArr!
{
///
let path = filePath.appending("/\(file)")
///
let floder = try! FileManager.default.attributesOfItem(atPath: path)
///
for (key, value) in floder
{
///
if key == FileAttributeKey.size
{
size += (value as AnyObject).floatValue
}
}
}
return size / 1024 / 1024
}
public func clearFile(filePath:String) {
//
let fileArr = FileManager.default.subpaths(atPath: filePath)
//
for file in fileArr!
{
let path = filePath.appending("/\(file)")
if FileManager.default.fileExists(atPath: path)
{
do
{
try FileManager.default.removeItem(atPath: path)
}
catch
{
}
}
}
}
}