struct ApplicationDirecrories {
+ static let shared = ApplicationDirecrories()
+
static let support = searchedURL(for: .applicationSupportDirectory)
.appendingPathComponent(supportDirName())
}
}
-extension ApplicationDirecrories {
-
- static let screenshotSaveDirectoryURL: URL = {
-
- let parentURL = URL(fileURLWithPath: AppDelegate.shared.screenShotSaveDirectory)
- let url = parentURL.appendingPathComponent(localizedAppName())
- let fm = FileManager.default
- var isDir: ObjCBool = false
-
- do {
-
- if !fm.fileExists(atPath: url.path, isDirectory: &isDir) {
-
- try fm.createDirectory(at: url, withIntermediateDirectories: false)
-
- } else if !isDir.boolValue {
-
- print("\(url) is regular file, not direcory.")
-
- return parentURL
- }
-
- } catch {
-
- print("Can not create screenshot save directory.")
-
- return parentURL
- }
-
- return url
- }()
-}
-
func createDirectory(_ url: URL) -> Bool {