mj 0.4.3

My Journal - personal tool to capture ideas, work with journals, notes and tasks in your favourite text $EDITOR.
Documentation
1
2
3
4
5
6
7
8
9
use std::fs;
use std::path::Path;

pub fn read_safe<P: AsRef<Path>>(path: P) -> String {
  match fs::read_to_string(path) {
    Ok(result) => result.to_owned(),
    Err(_) => "".to_owned(),
  }
}