blob: dd0a1324002db0ffe6c415e08ec95f9679bd3ed2 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
use crate::*;
mod cp;
mod ls;
mod mkdir;
mod rm;
pub use cp::*;
pub use ls::*;
pub use mkdir::*;
pub use rm::*;
/// Append bytes to the end of a file.
#[must_use]
pub fn append_to_file(_path: impl AsRef<Path>, _content: &str) -> WriteResult<()> {
unimplemented!()
}
/// Write a slice of bytes to a file, overwriting the existing file if it already exists.
#[must_use]
pub fn write_to_file(path: impl AsRef<Path>, content: impl AsRef<[u8]>) -> WriteResult<()> {
make_parent_directory(&path)?;
let write_result = std::fs::write(&path, content);
Ok(io_result_to_write_result(write_result, path.as_ref())?)
}
|