Skip to content

Commit

Permalink
Handle ~ right
Browse files Browse the repository at this point in the history
  • Loading branch information
yury committed Oct 24, 2019
1 parent b484540 commit 35bfc3d
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions Blink/Complete.swift
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,14 @@ struct Complete {
}

private static func _allPaths(prefix: String, skipFiles: Bool) -> [String] {
let arg = prefix as NSString
var pref = prefix
let home = BlinkPaths.documents()!
var cleanup = false
if pref.hasPrefix("~") {
pref = pref.replacingOccurrences(of: "~", with: home)
cleanup = true
}
let arg = pref as NSString
var dir: String
var isDir: ObjCBool = false
let fm = FileManager.default
Expand Down Expand Up @@ -376,7 +383,11 @@ struct Complete {
if skipFiles && !isDir.boolValue {
continue
}
result.append(folder)
if (cleanup) {
result.append(folder.replacingOccurrences(of: home, with: "~"))
} else {
result.append(folder)
}
}
}
return result;
Expand Down

0 comments on commit 35bfc3d

Please sign in to comment.