Resolve symlinks in file name standardization

This commit is contained in:
Matthias Neeracher 2015-04-26 18:58:40 +02:00 committed by Matthias Neeracher
parent 28f64bb631
commit dcc2fe689b

View File

@ -194,7 +194,7 @@ class ASFileItem : ASFileNode {
} }
func relativePath(relativeTo: String) -> String { func relativePath(relativeTo: String) -> String {
let path = url.path! let path = url.path!.stringByResolvingSymlinksInPath
let relComp = relativeTo.componentsSeparatedByString("/") as [String] let relComp = relativeTo.componentsSeparatedByString("/") as [String]
let pathComp = path.componentsSeparatedByString("/") as [String] let pathComp = path.componentsSeparatedByString("/") as [String]
let relCount = relComp.count let relCount = relComp.count
@ -260,17 +260,20 @@ class ASFileTree : NSObject, NSOutlineViewDataSource {
root.name = url.lastPathComponent!.stringByDeletingPathExtension root.name = url.lastPathComponent!.stringByDeletingPathExtension
dir = url.URLByDeletingLastPathComponent!.URLByStandardizingPath! dir = url.URLByDeletingLastPathComponent!.URLByStandardizingPath!
} }
func projectPath() -> String {
return dir.path!.stringByResolvingSymlinksInPath
}
func apply(closure: (ASFileNode) -> ()) { func apply(closure: (ASFileNode) -> ()) {
root.apply(closure) root.apply(closure)
} }
func propertyList() -> AnyObject { func propertyList() -> AnyObject {
return root.propertyList(dir.path!) return root.propertyList(projectPath())
} }
func readPropertyList(prop: NSDictionary) { func readPropertyList(prop: NSDictionary) {
root = ASFileNode.readPropertyList(prop, rootURL:dir) as! ASProject root = ASFileNode.readPropertyList(prop, rootURL:dir) as! ASProject
} }
var paths : [String] { var paths : [String] {
return root.paths(dir.path!) return root.paths(projectPath())
} }
// MARK: Outline Data Source // MARK: Outline Data Source