Skip to content

Commit 0817a30

Browse files
committed
Try to find windows resource compiler on PATH as a fallback
In some situations `find_msvc_tool` returns a `Tool` with an empty environment (without the Windows SDK tools in the PATH). In that case, try looking for `rc.exe` on the PATH
1 parent 5d1b897 commit 0817a30

File tree

1 file changed

+2
-0
lines changed
  • compiler/rustc_windows_rc/src

1 file changed

+2
-0
lines changed

compiler/rustc_windows_rc/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,9 @@ fn parse_version(version: &str) -> Option<ResourceVersion> {
135135
/// Find the Windows SDK resource compiler `rc.exe` for the given architecture or target triple.
136136
/// Returns `None` if the tool could not be found.
137137
fn find_resource_compiler(arch_or_target: &str) -> Option<path::PathBuf> {
138+
// Try to find the tool in a Windows SDK, or fall back to looking for it on the PATH
138139
find_windows_sdk_tool(arch_or_target, "rc.exe")
140+
.or_else(|| env::var_os("PATH").and_then(|p| find_tool_in_path("rc.exe", p)))
139141
}
140142

141143
/// Find a Windows SDK tool for the given architecture or target triple.

0 commit comments

Comments
 (0)