A file-based task manager

Swap order of archive/task dir creation

+4 -3
+4 -3
src/workspace.rs
··· 119 119 // WARN: we could improperly increment the id if the task is not written to disk/errors. 120 120 // But who cares 121 121 let id = self.next_id()?; 122 - let task_path = self.path.join("tasks").join(format!("tsk-{}.tsk", id.0)); 122 + // the task goes in the archive first 123 + let task_path = self.path.join("archive").join(format!("tsk-{}.tsk", id.0)); 123 124 let mut file = util::flopen(task_path.clone(), FlockArg::LockExclusive)?; 124 125 file.write_all(format!("{title}\n\n{body}").as_bytes())?; 125 - // create a hardlink to the archive dir 126 + // create a hardlink to the task dir to mark it as "open" 126 127 fs::hard_link( 127 128 task_path, 128 - self.path.join("archive").join(format!("tsk-{}.tsk", id.0)), 129 + self.path.join("tasks").join(format!("tsk-{}.tsk", id.0)), 129 130 )?; 130 131 Ok(Task { 131 132 id,