1
1
mirror of https://github.com/qvacua/vimr.git synced 2024-12-01 10:02:36 +03:00
vimr/VimR/FileItem.swift

46 lines
1.0 KiB
Swift
Raw Normal View History

/**
* Tae Won Ha - http://taewon.de - @hataewon
* See LICENSE
*/
import Foundation
class FileItem : CustomStringConvertible {
let url: NSURL
let dir: Bool
let hidden: Bool
let package: Bool
/// When nil, then it has never been fnmatch'ed.
weak var ignoreToken: Token?
var ignore = false
var needsScanChildren = false
var childrenScanned = false
var children: [FileItem] = []
var description: String {
2016-09-11 15:44:17 +03:00
return "<FileItem: \(self.url), dir=\(self.dir), hidden=\(self.hidden), package=\(self.package)"
+ "needsScan=\(self.needsScanChildren), childrenScanned=\(self.childrenScanned), "
+ "ignore=\(self.ignore), ignoreToken=\(self.ignoreToken), "
+ "children=\(self.children.count)>"
}
init(_ url: NSURL) {
self.url = url
self.dir = url.dir
self.hidden = url.hidden
self.package = url.package
}
2016-09-07 21:12:18 +03:00
func removeChild(withUrl url: NSURL) {
guard let idx = self.children.indexOf({ $0.url == url }) else {
return
}
self.children.removeAtIndex(idx)
}
}