Skip to main content

classify_local_source

Function classify_local_source 

Source
pub fn classify_local_source(input: &str) -> Option<PathBuf>
Expand description

Classify a source string as a local path if it matches local path syntax.

Accepted POSIX forms:

  • /absolute
  • ./relative, ../relative
  • ~/home-relative
  • . and ..

Accepted Windows forms:

  • Drive paths: C:\path, C:/path, C:relative
  • UNC paths: \\server\share\path
  • Root-relative: \path
  • Relative backslash: .\path, ..\path, foo\bar

Returns Some(PathBuf) if the input is a local path, None otherwise.

NOT classified as local paths (URL-like or shorthand):

  • Contains :// (URL scheme)
  • SSH shorthand: git@host:path
  • GitHub/GitLab shorthand: owner/repo (no backslash, has forward slash)
  • Protocol aliases: github:, gitlab: