mirror of
https://github.com/qvacua/vimr.git
synced 2024-12-25 23:02:35 +03:00
GH-297 Swift3'fy some methods
This commit is contained in:
parent
ebf4b61a58
commit
5a4592e035
@ -125,7 +125,7 @@ class FileItemService: StandardFlow {
|
||||
return Observable.empty()
|
||||
}
|
||||
|
||||
guard FileUtils.fileExistsAtUrl(url) else {
|
||||
guard FileUtils.fileExists(at: url) else {
|
||||
return Observable.empty()
|
||||
}
|
||||
|
||||
@ -260,7 +260,7 @@ class FileItemService: StandardFlow {
|
||||
if filteredChildren.isEmpty && create {
|
||||
let childUrl = parent.url.appendingPathComponent(name)
|
||||
|
||||
guard FileUtils.fileExistsAtUrl(childUrl) else {
|
||||
guard FileUtils.fileExists(at: childUrl) else {
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -274,7 +274,7 @@ class FileItemService: StandardFlow {
|
||||
}
|
||||
|
||||
fileprivate func scanChildren(_ item: FileItem) {
|
||||
let children = FileUtils.directDescendants(item.url).map(FileItem.init)
|
||||
let children = FileUtils.directDescendants(of: item.url).map(FileItem.init)
|
||||
self.syncAddChildren { item.children = children }
|
||||
|
||||
item.childrenScanned = true
|
||||
|
@ -23,7 +23,7 @@ class FileUtils {
|
||||
|
||||
static let userHomeUrl = URL(fileURLWithPath: NSHomeDirectory(), isDirectory: true)
|
||||
|
||||
static func directDescendants(_ url: URL) -> [URL] {
|
||||
static func directDescendants(of url: URL) -> [URL] {
|
||||
guard let childUrls = try? self.fileManager.contentsOfDirectory(
|
||||
at: url, includingPropertiesForKeys: self.keysToGet, options: self.scanOptions
|
||||
) else {
|
||||
@ -34,7 +34,7 @@ class FileUtils {
|
||||
return childUrls
|
||||
}
|
||||
|
||||
static func fileExistsAtUrl(_ url: URL) -> Bool {
|
||||
static func fileExists(at url: URL) -> Bool {
|
||||
guard url.isFileURL else {
|
||||
return false
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user