From 57bac1724bb9f28c24fb171ea1301d8290afd07c Mon Sep 17 00:00:00 2001 From: Max Desiatov Date: Mon, 9 Dec 2024 12:37:41 +0000 Subject: [PATCH] Fix some of `ProcessEnv.vars` and `AbsolutePath` warnings --- Sources/swift-driver/main.swift | 6 +++--- Sources/swift-help/main.swift | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Sources/swift-driver/main.swift b/Sources/swift-driver/main.swift index 497bf8644..ee699b151 100644 --- a/Sources/swift-driver/main.swift +++ b/Sources/swift-driver/main.swift @@ -73,7 +73,7 @@ do { // Fallback to legacy driver if forced to if CommandLine.arguments.contains(Option.disallowForwardingDriver.spelling) || - ProcessEnv.vars["SWIFT_USE_OLD_DRIVER"] != nil { + ProcessEnv.block["SWIFT_USE_OLD_DRIVER"] != nil { // If CommandLine.argument[0] is not an absolute path, we would form a path // relative to the current directory rather than relative to the actual // location of the binary. Use the Founation `NSProcessInfo` type to compute @@ -89,7 +89,7 @@ do { .appendingPathExtension(executable.pathExtension) let path: String = legacyExecutablePath.withUnsafeFileSystemRepresentation { String(cString: $0!) } - if localFileSystem.exists(AbsolutePath(path)) { + if try localFileSystem.exists(AbsolutePath(validating: path)) { let legacyDriverCommand = [path] + CommandLine.arguments[1...] try exec(path: path, args: legacyDriverCommand) } else { @@ -97,7 +97,7 @@ do { } } - if ProcessEnv.vars["SWIFT_ENABLE_EXPLICIT_MODULE"] != nil { + if ProcessEnv.block["SWIFT_ENABLE_EXPLICIT_MODULE"] != nil { CommandLine.arguments.append("-explicit-module-build") } diff --git a/Sources/swift-help/main.swift b/Sources/swift-help/main.swift index 0cb4f4c07..17b907fe7 100644 --- a/Sources/swift-help/main.swift +++ b/Sources/swift-help/main.swift @@ -93,7 +93,7 @@ struct SwiftHelp: ParsableCommand { } func printIntro() { - let is256Color = ProcessEnv.vars["TERM"] == "xterm-256color" + let is256Color = ProcessEnv.block["TERM"] == "xterm-256color" let orangeRed = is256Color ? "\u{001b}[1;38;5;196m" : "" let plain = is256Color ? "\u{001b}[0m" : "" let plainBold = is256Color ? "\u{001b}[1m" : ""