[ci] more; some fixes I found

This commit is contained in:
Max Howell
2021-05-28 09:35:35 -04:00
parent f9cee2c75f
commit eb33ff8906
8 changed files with 106 additions and 70 deletions

View File

@@ -29,7 +29,8 @@ public extension Pathish {
if overwrite, let tokind = to.type, tokind != .directory, type != .directory {
try FileManager.default.removeItem(at: to.url)
}
#if os(Linux) && !swift(>=5.3) // check if fixed
#if os(Linux)
//NOTE doing manually due to inconsistency in Linux Foundation behavior
if !overwrite, to.type != nil {
throw CocoaError.error(.fileWriteFileExists)
}
@@ -69,7 +70,8 @@ public extension Pathish {
if overwrite, let kind = rv.type, kind != .directory {
try FileManager.default.removeItem(at: rv.url)
}
#if os(Linux) && !swift(>=5.3) // check if fixed
#if os(Linux)
//NOTE doing manually due to inconsistency in Linux Foundation behavior
if !overwrite, rv.type != nil {
throw CocoaError.error(.fileWriteFileExists)
}

View File

@@ -168,6 +168,7 @@ public extension Pathish {
*/
var parent: Path {
let index = string.lastIndex(of: "/")!
guard index != string.indices.startIndex else { return Path(string: "/") }
let substr = string[string.indices.startIndex..<index]
return Path(string: String(substr))
}