Skip to main content

touch

Function touch 

Source
pub fn touch<T: AsRef<Path>>(path: T) -> FuResult<PathBuf>
Expand description

Create an empty file similar to the linux touch command. Handles path expansion. Uses default file creation permissions 0o666 - umask usually ends up being 0o644.

ยงExamples

use fungus::prelude::*;

let tmpdir = PathBuf::from("tests/temp").abs().unwrap().mash("file_doc_touch");
assert!(sys::remove_all(&tmpdir).is_ok());
let tmpfile = tmpdir.mash("file1");
assert!(sys::mkdir(&tmpdir).is_ok());
assert!(sys::touch(&tmpfile).is_ok());
assert_eq!(tmpfile.exists(), true);
assert!(sys::remove_all(&tmpdir).is_ok());