1
1
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:
Tae Won Ha 2016-11-24 00:08:41 +01:00
parent ebf4b61a58
commit 5a4592e035
No known key found for this signature in database
GPG Key ID: E40743465B5B8B44
2 changed files with 5 additions and 5 deletions

View File

@ -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

View File

@ -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
}