msys_to_windows_path

Function msys_to_windows_path 

Source
pub fn msys_to_windows_path(path: &str) -> String
Expand description

Convert an MSYS / Git-Bash POSIX drive path to a native Windows path.

Agents on Windows typically run inside a bash shell (MSYS2 / Git Bash), so they naturally emit paths like /c/Users/asafe/project or the WSL form /mnt/c/Users/asafe/project. Passing one of those straight to std::process::Command::current_dir makes CreateProcess fail with os error 267 (ERROR_DIRECTORY, “The directory name is invalid”).

Recognised forms (case-insensitive drive letter):

  • /cC:\
  • /c/Users/xC:\Users\x
  • /mnt/c/Users/xC:\Users\x

Anything that isn’t a POSIX drive path is returned unchanged. This is a no-op on non-Windows targets (the input is already a valid POSIX path).