OSDN Git Service

不要となっていたプロパティを削除
[kcd/KCD.git] / KCD / ApplicationDirecroriesExtension.swift
1 //
2 //  ApplicationDirecroriesExtension.swift
3 //  KCD
4 //
5 //  Created by Hori,Masaki on 2018/04/16.
6 //  Copyright © 2018年 Hori,Masaki. All rights reserved.
7 //
8
9 extension ApplicationDirecrories {
10     
11     static let screenshotSaveDirectoryURL: URL = {
12         
13         let parentURL = URL(fileURLWithPath: AppDelegate.shared.screenShotSaveDirectory)
14         let url = parentURL.appendingPathComponent(localizedAppName())
15         let fm = FileManager.default
16         var isDir: ObjCBool = false
17         
18         do {
19             
20             if !fm.fileExists(atPath: url.path, isDirectory: &isDir) {
21                 
22                 try fm.createDirectory(at: url, withIntermediateDirectories: false)
23                 
24             } else if !isDir.boolValue {
25                 
26                 print("\(url) is regular file, not direcory.")
27                 
28                 return parentURL
29             }
30             
31         } catch {
32             
33             print("Can not create screenshot save directory.")
34             
35             return parentURL
36         }
37         
38         return url
39     }()
40 }