Crates.io | rivia-vfs |
lib.rs | rivia-vfs |
version | 0.2.6 |
source | src |
created_at | 2021-11-20 14:31:29.599878 |
updated_at | 2024-07-01 17:48:44.837307 |
description | Ergonomic facade for the Rivia Virtual FileSystem |
homepage | |
repository | https://github.com/phR0ze/rivia-vfs |
max_upload_size | |
id | 484923 |
size | 108,348 |
Ergonomic facade for the Rivia Virtual FileSystem
[dependencies]
rivia-vfs = "0.2.6"
use rivia_vfs::prelude::*;
fn main() {
// Simply remove this line to default to the real filesystem.
vfs::set_memfs().unwrap();
let config = load_config();
assert_eq!(config, "this is a test");
println!("VFS test passed");
}
// Load an example application configuration file using VFS.
// This allows you to test with a memory backed VFS implementation during testing and with
// the real filesystem during production.
fn load_config() -> String {
let dir = PathBuf::from("/etc/xdg");
vfs::mkdir_p(&dir).unwrap();
let filepath = dir.mash("rivia.toml");
vfs::write_all(&filepath, "this is a test").unwrap();
assert_eq!(vfs::config_dir("rivia.toml").unwrap().to_str().unwrap(), "/etc/xdg");
if let Some(config_dir) = vfs::config_dir("rivia.toml") {
let path = config_dir.mash("rivia.toml");
return vfs::read_all(&path).unwrap();
}
"".into()
}
This minimum rustc requirement is driven by the enhancements made to Rust's std::error::Error
handling improvements
Pull requests are always welcome. However understand that they will be evaluated purely on whether or not the change fits with my goals/ideals for the project.
Project guidelines:
Enable the git hooks to have the version automatically incremented on commits
cd ~/Projects/rivia-vfs
git config core.hooksPath .githooks
TBD
This project is licensed under either of:
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project by you, shall be dual licensed as above, without any additional terms or conditions.