Update to Swift 6.1

This commit is contained in:
Sami Samhuri 2025-07-19 01:32:16 +00:00
parent fb47d33699
commit 4e215d6c3b
No known key found for this signature in database
3 changed files with 6 additions and 6 deletions

View file

@ -1,4 +1,4 @@
// swift-tools-version:6.0 // swift-tools-version:6.1
// The swift-tools-version declares the minimum version of Swift required to build this package. // The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription import PackageDescription

View file

@ -10,7 +10,7 @@ import samhuri_net
guard CommandLine.arguments.count >= 3 else { guard CommandLine.arguments.count >= 3 else {
let name = CommandLine.arguments[0] let name = CommandLine.arguments[0]
fputs("Usage: \(name) <site dir> <target dir>\n", stderr) FileHandle.standardError.write("Usage: \(name) <site dir> <target dir>\n".data(using: .utf8)!)
exit(1) exit(1)
} }
@ -18,7 +18,7 @@ let sourcePath = CommandLine.arguments[1]
var isDir: ObjCBool = false var isDir: ObjCBool = false
let sourceExists = FileManager.default.fileExists(atPath: sourcePath, isDirectory: &isDir) let sourceExists = FileManager.default.fileExists(atPath: sourcePath, isDirectory: &isDir)
guard sourceExists, isDir.boolValue else { guard sourceExists, isDir.boolValue else {
fputs("error: Site path \(sourcePath) does not exist or is not a directory\n", stderr) FileHandle.standardError.write("error: Site path \(sourcePath) does not exist or is not a directory\n".data(using: .utf8)!)
exit(2) exit(2)
} }
@ -28,7 +28,7 @@ let siteURLOverride: URL?
if CommandLine.argc > 3, CommandLine.arguments[3].isEmpty == false { if CommandLine.argc > 3, CommandLine.arguments[3].isEmpty == false {
let urlString = CommandLine.arguments[3] let urlString = CommandLine.arguments[3]
guard let url = URL(string: urlString) else { guard let url = URL(string: urlString) else {
fputs("error: invalid site URL \(urlString)\n", stderr) FileHandle.standardError.write("error: invalid site URL \(urlString)\n".data(using: .utf8)!)
exit(4) exit(4)
} }
siteURLOverride = url siteURLOverride = url
@ -45,6 +45,6 @@ do {
exit(0) exit(0)
} }
catch { catch {
fputs("error: \(error)\n", stderr) FileHandle.standardError.write("error: \(error)\n".data(using: .utf8)!)
exit(-1) exit(-1)
} }

View file

@ -1,4 +1,4 @@
// swift-tools-version:6.0 // swift-tools-version:6.1
// The swift-tools-version declares the minimum version of Swift required to build this package. // The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription import PackageDescription