create session file even in read_only mode
@@ -115,11 +115,11 @@ impl Session {
}
pub fn persist(&self) -> Result<()> {
+ if !self.path.exists() || !self.read_only {
if let Some(parent_path) = self.path.parent() {
fs::create_dir_all(parent_path)?;
}
let mut session_file = fs::File::create(&self.path)?;
- if !self.read_only {
let formatter = serde_json::ser::PrettyFormatter::with_indent(b" ");
let mut ser = serde_json::Serializer::with_formatter(&mut session_file, formatter);
self.content.serialize(&mut ser)?;
