chwp 1.239.71

Change your wallpaper from the command line interface.
1
2
3
4
5
6
7
8
9
10
11
// Common utilities shared across modules

/// Expand a leading "~/" to the user's home directory. If expansion fails, returns the input.
pub fn expand_tilde(path: &str) -> String {
    if let Some(rest) = path.strip_prefix("~/") {
        if let Some(home) = dirs::home_dir() {
            return home.join(rest).to_string_lossy().into_owned();
        }
    }
    path.to_string()
}