OSDN Git Service

shared instanceを持つようにした
[kcd/KCD.git] / KCD / ApplicationDirecrories.swift
index acdf279..bbab898 100644 (file)
@@ -31,6 +31,8 @@ func localizedAppName() -> String {
 
 struct ApplicationDirecrories {
     
+    static let shared = ApplicationDirecrories()
+    
     static let support = searchedURL(for: .applicationSupportDirectory)
         .appendingPathComponent(supportDirName())
     
@@ -46,37 +48,6 @@ struct ApplicationDirecrories {
     }
 }
 
-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 {