From dcc2fe689bfad21a221bdd7a1b90782832e984cc Mon Sep 17 00:00:00 2001 From: Matthias Neeracher Date: Sun, 26 Apr 2015 18:58:40 +0200 Subject: [PATCH] Resolve symlinks in file name standardization --- AVRsack/ASFileTree.swift | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/AVRsack/ASFileTree.swift b/AVRsack/ASFileTree.swift index a7b54a2..74cf000 100644 --- a/AVRsack/ASFileTree.swift +++ b/AVRsack/ASFileTree.swift @@ -194,7 +194,7 @@ class ASFileItem : ASFileNode { } func relativePath(relativeTo: String) -> String { - let path = url.path! + let path = url.path!.stringByResolvingSymlinksInPath let relComp = relativeTo.componentsSeparatedByString("/") as [String] let pathComp = path.componentsSeparatedByString("/") as [String] let relCount = relComp.count @@ -260,17 +260,20 @@ class ASFileTree : NSObject, NSOutlineViewDataSource { root.name = url.lastPathComponent!.stringByDeletingPathExtension dir = url.URLByDeletingLastPathComponent!.URLByStandardizingPath! } + func projectPath() -> String { + return dir.path!.stringByResolvingSymlinksInPath + } func apply(closure: (ASFileNode) -> ()) { root.apply(closure) } func propertyList() -> AnyObject { - return root.propertyList(dir.path!) + return root.propertyList(projectPath()) } func readPropertyList(prop: NSDictionary) { root = ASFileNode.readPropertyList(prop, rootURL:dir) as! ASProject } var paths : [String] { - return root.paths(dir.path!) + return root.paths(projectPath()) } // MARK: Outline Data Source