Skip to content

Commit e9d3724

Browse files
committed
update
1 parent ffb179b commit e9d3724

File tree

2 files changed

+8
-36
lines changed

2 files changed

+8
-36
lines changed

RsyncUI/Model/Global/ObservableRestore.swift

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -30,24 +30,9 @@ final class ObservableRestore {
3030
presentrestorelist = true
3131
}
3232

33-
func verifypathforrestore(_ atpath: String) -> Bool {
34-
do {
35-
let ok = try validatepath(atpath)
36-
if ok {
37-
return true
38-
}
39-
return false
40-
} catch {
41-
return false
42-
}
43-
}
44-
45-
private func validatepath(_ path: String) throws -> Bool {
33+
func verifypathforrestore(_ path: String) -> Bool {
4634
let fm = FileManager.default
47-
if fm.fileExists(atPath: path, isDirectory: nil) == false {
48-
throw Validatedpath.nopath
49-
}
50-
return true
35+
return fm.fileExists(atPath: path, isDirectory: nil)
5136
}
5237

5338
func executerestore() {

RsyncUI/Model/Global/ObservableRsyncPathSetting.swift

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -40,19 +40,13 @@ final class ObservableRsyncPathSetting {
4040
return false
4141
}
4242
}
43-
44-
func verifypathforrestore(_ atpath: String) -> Bool {
45-
do {
46-
let ok = try validatepath(atpath)
47-
if ok {
48-
return true
49-
}
50-
return false
51-
} catch {
52-
return false
53-
}
43+
44+
func verifypathforrestore(_ path: String) -> Bool {
45+
let fm = FileManager.default
46+
return fm.fileExists(atPath: path, isDirectory: nil)
5447
}
5548

49+
5650
// Only validate path if rsyncver3 is true
5751
func setandvalidatepathforrsync(_ path: String) -> Bool {
5852
guard path.isEmpty == false, rsyncversion3 == true else {
@@ -72,14 +66,7 @@ final class ObservableRsyncPathSetting {
7266
}
7367
}
7468

75-
private func validatepath(_ path: String) throws -> Bool {
76-
let fm = FileManager.default
77-
if fm.fileExists(atPath: path, isDirectory: nil) == false {
78-
throw Validatedpath.nopath
79-
}
80-
return true
81-
}
82-
69+
8370
private func verifystringtoint(_ seconds: String) throws -> Bool {
8471
guard seconds.isEmpty == false else { return false }
8572
if Int(seconds) != nil {

0 commit comments

Comments
 (0)