Page MenuHomePhorge

dump.rs
No OneTemporary

Size
899 B
Referenced Files
None
Subscribers
None
use crate::{
file::{self, Exists},
helpers,
process::{id::Id, Runner},
};
use colored::Colorize;
use global_placeholders::global;
use macros_rs::{crashln, string};
use std::{collections::BTreeMap, fs};
pub fn read() -> Runner {
if !Exists::file(global!("pmc.dump")).unwrap() {
let runner = Runner {
id: Id::new(0),
process_list: BTreeMap::new(),
};
write(&runner);
log::info!("created dump file");
}
file::read(global!("pmc.dump"))
}
pub fn write(dump: &Runner) {
let contents = match toml::to_string(dump) {
Ok(contents) => contents,
Err(err) => crashln!("{} Cannot parse dump.\n{}", *helpers::FAIL, string!(err).white()),
};
if let Err(err) = fs::write(global!("pmc.dump"), contents) {
crashln!("{} Error writing dumpfile.\n{}", *helpers::FAIL, string!(err).white())
}
}

File Metadata

Mime Type
text/plain
Expires
Thu, May 29, 12:50 PM (21 h, 14 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
200461
Default Alt Text
dump.rs (899 B)

Event Timeline