25 lines
538 B
Swift
25 lines
538 B
Swift
//
|
|
// Utils.swift
|
|
// pass
|
|
//
|
|
// Created by Mingshen Sun on 8/2/2017.
|
|
// Copyright © 2017 Bob Sun. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
class Utils {
|
|
static func removeFileIfExists(atPath path: String) {
|
|
let fm = FileManager.default
|
|
do {
|
|
if fm.fileExists(atPath: path) {
|
|
try fm.removeItem(atPath: path)
|
|
}
|
|
} catch {
|
|
print(error)
|
|
}
|
|
}
|
|
static func removeFileIfExists(at url: URL) {
|
|
removeFileIfExists(atPath: url.path)
|
|
}
|
|
}
|