Skip to main content

expand_tilde

Function expand_tilde 

Source
pub fn expand_tilde(raw: &str) -> String
Expand description

Expand a leading ~ to the user’s home directory.

POSIX shells do this before the argument ever reaches a program, so on Linux and macOS it is usually a no-op. PowerShell and cmd do not: they hand a native executable the literal three characters ~/C, and devp init ~/Code — the exact line in the README and on the landing page — would register a directory called ~ sitting in the current working directory. Quoting defeats the expansion in every shell, so devp init "~/Code" needs this too.

Only a bare ~ or a ~ followed by a separator is expanded. ~alice means “some other user’s home” in shell syntax and cannot be resolved portably, and ~backup is a perfectly ordinary directory name.