Retain original filename as imported profile name (#240)
This commit is contained in:
parent
dad6d820e9
commit
22c28de641
|
@ -49,7 +49,7 @@ extension AddHostView {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
isNamePreset = true
|
isNamePreset = true
|
||||||
profileName = url.normalizedFilename
|
profileName = url.filename
|
||||||
}
|
}
|
||||||
|
|
||||||
@MainActor
|
@MainActor
|
||||||
|
|
|
@ -32,11 +32,8 @@ import AppKit
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extension URL {
|
extension URL {
|
||||||
private static let illegalCharacterFallback = "_"
|
public var filename: String {
|
||||||
|
deletingPathExtension().lastPathComponent
|
||||||
public var normalizedFilename: String {
|
|
||||||
let filename = deletingPathExtension().lastPathComponent
|
|
||||||
return filename.components(separatedBy: CharacterSet.filename.inverted).joined(separator: URL.illegalCharacterFallback)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@discardableResult
|
@discardableResult
|
||||||
|
|
Loading…
Reference in New Issue