Fix project import
This commit is contained in:
parent
8bc7fa53f4
commit
beb70e0158
|
@ -162,7 +162,11 @@ class ASFileItem : ASFileNode {
|
||||||
}
|
}
|
||||||
init(_ prop: NSDictionary, withRootURL rootURL: NSURL) {
|
init(_ prop: NSDictionary, withRootURL rootURL: NSURL) {
|
||||||
type = ASFileType(rawValue: prop[kKindKey] as String)!
|
type = ASFileType(rawValue: prop[kKindKey] as String)!
|
||||||
url = NSURL(string: prop[kPathKey] as NSString, relativeToURL: rootURL)!.standardizedURL!
|
if let relativeURL = NSURL(string: prop[kPathKey] as NSString, relativeToURL: rootURL) {
|
||||||
|
url = relativeURL.standardizedURL!
|
||||||
|
} else {
|
||||||
|
url = NSURL(fileURLWithPath: prop[kPathKey] as NSString)!.standardizedURL!
|
||||||
|
}
|
||||||
}
|
}
|
||||||
override func nodeName() -> String {
|
override func nodeName() -> String {
|
||||||
return "📄 "+url.lastPathComponent
|
return "📄 "+url.lastPathComponent
|
||||||
|
|
|
@ -166,6 +166,7 @@ class ASProjDoc: NSDocument, NSOutlineViewDelegate, NSMenuDelegate {
|
||||||
let filesInProject =
|
let filesInProject =
|
||||||
NSFileManager.defaultManager().contentsOfDirectoryAtURL(url, includingPropertiesForKeys: nil,
|
NSFileManager.defaultManager().contentsOfDirectoryAtURL(url, includingPropertiesForKeys: nil,
|
||||||
options: .SkipsHiddenFiles, error: nil)!
|
options: .SkipsHiddenFiles, error: nil)!
|
||||||
|
files.setProjectURL(fileURL!)
|
||||||
for file in filesInProject {
|
for file in filesInProject {
|
||||||
files.addFileURL(file as NSURL)
|
files.addFileURL(file as NSURL)
|
||||||
}
|
}
|
||||||
|
@ -178,8 +179,8 @@ class ASProjDoc: NSDocument, NSOutlineViewDelegate, NSMenuDelegate {
|
||||||
let projectURL = url.URLByDeletingPathExtension!.URLByAppendingPathExtension("avrsackproj")
|
let projectURL = url.URLByDeletingPathExtension!.URLByAppendingPathExtension("avrsackproj")
|
||||||
success = importProject(url.URLByDeletingLastPathComponent!, error: outError)
|
success = importProject(url.URLByDeletingLastPathComponent!, error: outError)
|
||||||
if success {
|
if success {
|
||||||
files.setProjectURL(fileURL!)
|
files.setProjectURL(projectURL)
|
||||||
builder.setProjectURL(fileURL!)
|
builder.setProjectURL(projectURL)
|
||||||
fileURL = projectURL
|
fileURL = projectURL
|
||||||
success = writeToURL(projectURL, ofType: "Project", forSaveOperation: .SaveAsOperation, originalContentsURL: nil, error: outError)
|
success = writeToURL(projectURL, ofType: "Project", forSaveOperation: .SaveAsOperation, originalContentsURL: nil, error: outError)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user