Skip to main content

extract_filename_from_path

Function extract_filename_from_path 

Source
pub fn extract_filename_from_path(path: &str) -> Option<&str>
Expand description

Extract executable name from a path, stripping .exe on Windows.

Uses std::path::Path for platform-native path handling:

  • Unix: /usr/bin/bash -> “bash”
  • Windows: C:\Program Files\Git\usr\bin\bash.exe -> “bash”

Only strips .exe extension (not other extensions like .9 in zsh-5.9).