melib: maildir set extension properly

embed
Manos Pitsidianakis 2019-02-09 22:41:13 +02:00
parent 998414aa5a
commit 1b3fe2a391
Signed by: Manos Pitsidianakis
GPG Key ID: 73627C2F690DF710
1 changed files with 10 additions and 11 deletions

View File

@ -131,16 +131,17 @@ fn get_file_hash(file: &Path) -> EnvelopeHash {
} }
fn move_to_cur(p: PathBuf) -> PathBuf { fn move_to_cur(p: PathBuf) -> PathBuf {
eprintln!("moved to cur"); let mut new = p.clone();
let mut new = p.clone(); {
{ let file_name = p.file_name().unwrap();
let file_name = p.file_name().unwrap(); new.pop();
new.pop(); new.pop();
new.pop();
new.push("cur"); new.push("cur");
new.push(file_name); new.push(file_name);
} new.set_extension(":2,");
}
eprintln!("moved to cur: {}", new.display());
fs::rename(p, &new).unwrap(); fs::rename(p, &new).unwrap();
new new
} }
@ -428,7 +429,6 @@ impl MaildirType {
let thunk = move || { let thunk = move || {
let mut path = path.clone(); let mut path = path.clone();
let cache_dir = cache_dir.clone(); let cache_dir = cache_dir.clone();
{
path.push("new"); path.push("new");
for d in path.read_dir()? { for d in path.read_dir()? {
if let Ok(p) = d { if let Ok(p) = d {
@ -436,7 +436,6 @@ impl MaildirType {
} }
} }
path.pop(); path.pop();
}
path.push("cur"); path.push("cur");
let iter = path.read_dir()?; let iter = path.read_dir()?;