Improve relative paths, check missing files

This commit is contained in:
Christoph Hagen
2022-08-29 13:33:48 +02:00
parent 761845311e
commit 268c0e5f39
4 changed files with 103 additions and 15 deletions

View File

@ -21,11 +21,17 @@ extension String {
}
func dropAfterLast(_ separator: String) -> String {
components(separatedBy: separator).dropLast().joined(separator: separator)
guard contains(separator) else {
return self
}
return components(separatedBy: separator).dropLast().joined(separator: separator)
}
func dropBeforeFirst(_ separator: String) -> String {
components(separatedBy: separator).dropFirst().joined(separator: separator)
guard contains(separator) else {
return self
}
return components(separatedBy: separator).dropFirst().joined(separator: separator)
}
func lastComponentAfter(_ separator: String) -> String {