Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some of ProcessEnv.vars and AbsolutePath warnings #1751

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Sources/swift-driver/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -89,15 +89,15 @@ 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 {
throw Driver.Error.unknownOrMissingSubcommand(legacyExecutablePath.lastPathComponent)
}
}

if ProcessEnv.vars["SWIFT_ENABLE_EXPLICIT_MODULE"] != nil {
if ProcessEnv.block["SWIFT_ENABLE_EXPLICIT_MODULE"] != nil {
CommandLine.arguments.append("-explicit-module-build")
}

Expand Down
2 changes: 1 addition & 1 deletion Sources/swift-help/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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" : ""
Expand Down