Compare document path.

This commit is contained in:
Tom Alexander 2023-09-29 21:20:23 -04:00
parent 3fb2b5d31c
commit f1e35e317b
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE

View File

@ -438,9 +438,31 @@ pub fn compare_document<'s>(
Ok(_) => {}
}
// TODO: Compare :path
// Compare :path
// :path is a quoted string to the absolute path of the document.
let document_path = get_property_quoted_string(emacs, ":path")?;
let rust_document_path = rust.path.as_ref().map(|p| p.to_str()).flatten();
match (
document_path.as_ref().map(|s| s.as_str()),
rust_document_path,
) {
(None, None) => {}
(None, Some(_)) | (Some(_), None) => {
this_status = DiffStatus::Bad;
message = Some(format!(
"Path mismatch (emacs != rust) {:?} != {:?}",
document_path, rust_document_path
));
}
(Some(e), Some(r)) if e != r => {
this_status = DiffStatus::Bad;
message = Some(format!(
"Path mismatch (emacs != rust) {:?} != {:?}",
document_path, rust_document_path
));
}
(Some(_), Some(_)) => {}
};
// Compare category
// :CATEGORY is specified either from "#+CATEGORY:" or it is the file name without the ".org" extension.