···132 // WARN: we could improperly increment the id if the task is not written to disk/errors.
133 // But who cares
134 let id = self.next_id()?;
0135 // the task goes in the archive first
136- let task_path = self.path.join("archive").join(format!("tsk-{}.tsk", id.0));
137 let mut file = util::flopen(task_path.clone(), FlockArg::LockExclusive)?;
138 file.write_all(format!("{title}\n\n{body}").as_bytes())?;
139 // create a hardlink to the task dir to mark it as "open"
140 symlink(
141- task_path,
142- self.path.join("tasks").join(format!("tsk-{}.tsk", id.0)),
143 )?;
144 Ok(Task {
145 id,
···132 // WARN: we could improperly increment the id if the task is not written to disk/errors.
133 // But who cares
134 let id = self.next_id()?;
135+ let task_name = format!("tsk-{}.tsk", id.0);
136 // the task goes in the archive first
137+ let task_path = self.path.join("archive").join(&task_name);
138 let mut file = util::flopen(task_path.clone(), FlockArg::LockExclusive)?;
139 file.write_all(format!("{title}\n\n{body}").as_bytes())?;
140 // create a hardlink to the task dir to mark it as "open"
141 symlink(
142+ PathBuf::from("../archive").join(&task_name),
143+ self.path.join("tasks").join(task_name),
144 )?;
145 Ok(Task {
146 id,