Pretend dos line endings do not exist.
This commit is contained in:
parent
7f751d4f28
commit
fd41ad9c29
@ -14,7 +14,9 @@ use crate::LocalFileAccessInterface;
|
|||||||
pub fn run_anonymous_compare<P: AsRef<str>>(
|
pub fn run_anonymous_compare<P: AsRef<str>>(
|
||||||
org_contents: P,
|
org_contents: P,
|
||||||
) -> Result<(), Box<dyn std::error::Error>> {
|
) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let org_contents = org_contents.as_ref();
|
// TODO: This is a work-around to pretend that dos line endings do not exist. It would be better to handle the difference in line endings.
|
||||||
|
let org_contents = org_contents.as_ref().replace("\r\n", "\n");
|
||||||
|
let org_contents = org_contents.as_str();
|
||||||
eprintln!("Using emacs version: {}", get_emacs_version()?.trim());
|
eprintln!("Using emacs version: {}", get_emacs_version()?.trim());
|
||||||
eprintln!("Using org-mode version: {}", get_org_mode_version()?.trim());
|
eprintln!("Using org-mode version: {}", get_org_mode_version()?.trim());
|
||||||
let rust_parsed = parse(org_contents)?;
|
let rust_parsed = parse(org_contents)?;
|
||||||
@ -44,6 +46,8 @@ pub fn run_compare_on_file<P: AsRef<Path>>(org_path: P) -> Result<(), Box<dyn st
|
|||||||
.parent()
|
.parent()
|
||||||
.ok_or("Should be contained inside a directory.")?;
|
.ok_or("Should be contained inside a directory.")?;
|
||||||
let org_contents = std::fs::read_to_string(org_path)?;
|
let org_contents = std::fs::read_to_string(org_path)?;
|
||||||
|
// TODO: This is a work-around to pretend that dos line endings do not exist. It would be better to handle the difference in line endings.
|
||||||
|
let org_contents = org_contents.replace("\r\n", "\n");
|
||||||
let org_contents = org_contents.as_str();
|
let org_contents = org_contents.as_str();
|
||||||
let file_access_interface = LocalFileAccessInterface {
|
let file_access_interface = LocalFileAccessInterface {
|
||||||
working_directory: Some(parent_directory.to_path_buf()),
|
working_directory: Some(parent_directory.to_path_buf()),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user