From cac733eaeae1bf3bb75e0e66d4538a2d88dbded1 Mon Sep 17 00:00:00 2001 From: Jeremy Wall Date: Thu, 4 Jun 2020 15:48:34 -0500 Subject: [PATCH] FIX: Bad path handling on unix platforms. --- src/ast/rewrite.rs | 38 ++++---------------------------------- 1 file changed, 4 insertions(+), 34 deletions(-) diff --git a/src/ast/rewrite.rs b/src/ast/rewrite.rs index d0d940a..ab0b37a 100644 --- a/src/ast/rewrite.rs +++ b/src/ast/rewrite.rs @@ -32,23 +32,8 @@ impl Visitor for Rewriter { let main_separator = format!("{}", std::path::MAIN_SEPARATOR); if let Expression::Include(ref mut def) = expr { let path = PathBuf::from(&def.path.fragment); - #[cfg(not(windows))] - { - if path.is_relative() { - def.path.fragment = self - .base - .join(path) - .canonicalize() - .unwrap() - .to_string_lossy() - .to_string(); - } - } - #[cfg(windows)] - { - if path.is_relative() { - def.path.fragment = self.base.join(path).to_string_lossy().to_string(); - } + if path.is_relative() { + def.path.fragment = self.base.join(path).to_string_lossy().to_string(); } } if let Expression::Import(ref mut def) = expr { @@ -62,23 +47,8 @@ impl Visitor for Rewriter { if path.starts_with(format!("std{}", main_separator)) { return; } - #[cfg(not(windows))] - { - if path.is_relative() { - def.path.fragment = self - .base - .join(path) - .canonicalize() - .unwrap() - .to_string_lossy() - .to_string(); - } - } - #[cfg(windows)] - { - if path.is_relative() { - def.path.fragment = self.base.join(path).to_string_lossy().to_string(); - } + if path.is_relative() { + def.path.fragment = self.base.join(path).to_string_lossy().to_string(); } } }