File tree Expand file tree Collapse file tree 1 file changed +12
-9
lines changed
Expand file tree Collapse file tree 1 file changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -14,18 +14,21 @@ public final class UBKit {
1414 public func run( _ completion: @escaping ( ( Error ? ) -> Void ) ) {
1515 let workingPath = fileManager. currentDirectoryPath
1616 do {
17- if let fileData = fileManager. contents ( atPath: workingPath. appending ( " /ubconfig.json " ) ) {
18- if let configJSON = try JSONSerialization . jsonObject ( with: fileData, options: . allowFragments) as? [ String : String ] {
19- guard let config = Config ( json: configJSON) else {
20- completion ( UBKitError . invalidConfigFile)
21- return
22- }
23- kitManager = UBKitManager ( config: config)
17+ guard let fileData = fileManager. contents ( atPath: workingPath. appending ( " /ubconfig.json " ) ) else {
18+ completion ( UBKitError . invalidFolder ( workingPath. appending ( " /ubconfig.json " ) ) )
19+ return
20+ }
21+ if let configJSON = try JSONSerialization . jsonObject ( with: fileData, options: . allowFragments) as? [ String : String ] {
22+ guard let config = Config ( json: configJSON) else {
23+ completion ( UBKitError . invalidConfigFile)
24+ return
2425 }
25-
26+ kitManager = UBKitManager ( config : config )
2627 }
28+
2729 } catch {
28- completion ( UBKitError . invalidFolder ( workingPath. appending ( " /ubconfig.json " ) ) )
30+ completion ( error)
31+ return
2932 }
3033
3134 let taskResult = kitManager. performTasks ( )
You can’t perform that action at this time.
0 commit comments