This commit is contained in:
Olof Blomqvist 2023-08-04 20:22:57 +02:00 committed by Lucas
parent 4e4a477ff1
commit d25bb9ae60
1 changed files with 7 additions and 7 deletions

View File

@ -163,22 +163,22 @@ impl Server {
aiken_lang::format::pretty(&mut new_text, module, extra, src);
}
None => {
let src = {
#[cfg(not(target_os = "windows"))] {
#[cfg(not(target_os = "windows"))]
{
fs::read_to_string(path).map_err(ProjectError::from)?
}
#[cfg(target_os = "windows")] {
#[cfg(target_os = "windows")]
{
let temp = match urlencoding::decode(path) {
Ok(decoded) => decoded.to_string(),
Err(_) => path.to_owned()
Err(_) => path.to_owned(),
};
fs::read_to_string(temp.trim_start_matches("/")).map_err(ProjectError::from)?
fs::read_to_string(temp.trim_start_matches("/"))
.map_err(ProjectError::from)?
}
};
let (module, extra) = parser::module(&src, ModuleKind::Lib).map_err(|errs| {
aiken_project::error::Error::from_parse_errors(errs, Path::new(path), &src)
})?;