to_native_path_display

Function to_native_path_display 

Source
pub fn to_native_path_display(unix_path: &str) -> String
Expand description

Convert Unix-style path (from lockfile) to platform-native format for display in templates.

Lockfiles always use Unix-style forward slashes for cross-platform compatibility, but when rendering templates, we want to show paths in the platform’s native format so users see .claude\agents\helper.md on Windows and .claude/agents/helper.md on Unix.

§Arguments

  • unix_path - Path string with forward slashes (from lockfile)

§Returns

Platform-native path string (backslashes on Windows, forward slashes on Unix)

§Examples

#[cfg(windows)]
assert_eq!(to_native_path_display(".claude/agents/test.md"), ".claude\\agents\\test.md");

#[cfg(not(windows))]
assert_eq!(to_native_path_display(".claude/agents/test.md"), ".claude/agents/test.md");