mayday 0.1.0

A multi-messaging-sevice aggregator into an all-in-one application (android's app beeper-like)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use std::path::PathBuf;
use directories::UserDirs;

#[allow(unused)]
pub fn expand_tilde(path_buf: PathBuf) -> PathBuf {
    if !path_buf.starts_with("~/") {
        return path_buf;
    }

    match UserDirs::new() {
        Some(user_dirs) => {
            let mut home_dir = user_dirs.home_dir().to_path_buf();
            home_dir.push(path_buf.strip_prefix("~/").unwrap());
            home_dir
        },
        None => panic!("No home directory found when trying to expand \"~\"")
    }
}