restores Helder in all its glory

This commit is contained in:
2026-09-28 11:34:49 +02:00
parent c2b38b853c
commit 1d29d0952d
280 changed files with 29205 additions and 7 deletions
@@ -0,0 +1,38 @@
import Foundation
/// A small case-sensitive APFS disk image, attached for one test and detached on deinit.
final class CaseSensitiveVolume {
let root: URL
private let image: URL
init() throws {
let base = FileManager.default.temporaryDirectory
.appendingPathComponent("helder-cs-\(UUID().uuidString)")
.resolvingSymlinksInPath()
try FileManager.default.createDirectory(at: base, withIntermediateDirectories: true)
image = base.appendingPathComponent("volume.dmg")
root = base.appendingPathComponent("mount")
try FileManager.default.createDirectory(at: root, withIntermediateDirectories: true)
try Self.hdiutil(["create", "-quiet", "-size", "8m", "-fs", "Case-sensitive APFS", "-volname", "HelderCS", image.path])
try Self.hdiutil(["attach", "-quiet", "-nobrowse", "-mountpoint", root.path, image.path])
}
deinit {
try? Self.hdiutil(["detach", "-quiet", "-force", root.path])
try? FileManager.default.removeItem(at: image.deletingLastPathComponent())
}
private static func hdiutil(_ arguments: [String]) throws {
let process = Process()
process.executableURL = URL(fileURLWithPath: "/usr/bin/hdiutil")
process.arguments = arguments
process.standardInput = FileHandle.nullDevice
process.standardOutput = FileHandle.nullDevice
process.standardError = FileHandle.nullDevice
try process.run()
process.waitUntilExit()
guard process.terminationStatus == 0 else {
throw NSError(domain: "hdiutil", code: Int(process.terminationStatus), userInfo: [NSLocalizedDescriptionKey: arguments.joined(separator: " ")])
}
}
}