Make sure VIMRC doesn't contain \r (fix #476) (#482)

This commit is contained in:
Roey Darwish Dror
2020-07-21 09:09:37 +03:00
committed by GitHub
parent 0cfae3d5eb
commit e3d2d11e8a
2 changed files with 3 additions and 1 deletions

View File

@@ -35,7 +35,7 @@ fn nvimrc(base_dirs: &BaseDirs) -> Option<PathBuf> {
fn upgrade(vim: &PathBuf, vimrc: &PathBuf, ctx: &ExecutionContext) -> Result<()> { fn upgrade(vim: &PathBuf, vimrc: &PathBuf, ctx: &ExecutionContext) -> Result<()> {
let mut tempfile = tempfile::NamedTempFile::new()?; let mut tempfile = tempfile::NamedTempFile::new()?;
tempfile.write_all(UPGRADE_VIM.as_bytes())?; tempfile.write_all(UPGRADE_VIM.replace('\r', "").as_bytes())?;
debug!("Wrote vim script to {:?}", tempfile.path()); debug!("Wrote vim script to {:?}", tempfile.path());
let output = ctx let output = ctx

View File

@@ -45,8 +45,10 @@ where
{ {
fn if_exists(self) -> Option<Self> { fn if_exists(self) -> Option<Self> {
if self.as_ref().exists() { if self.as_ref().exists() {
debug!("Path {:?} exists", self.as_ref());
Some(self) Some(self)
} else { } else {
debug!("Path {:?} doesn't exist", self.as_ref());
None None
} }
} }