Make imports work on all OSes
This commit is contained in:
parent
5aa365c681
commit
95133360ee
@ -304,10 +304,7 @@ fn resolve_imports(tokens: &mut Vec<Token>, functions: &mut Vec<Function>, file_
|
||||
{
|
||||
if let Some(Token::StringLit(import_path, _, _)) = tokens_iter.next()
|
||||
{
|
||||
match fs::canonicalize(format!("{}/{}", fs::canonicalize(file_path).map_err(|e| e.to_string())?.parent().unwrap_or(&PathBuf::from(".")).display(), import_path))
|
||||
{
|
||||
Ok(full_import_path) =>
|
||||
{
|
||||
let full_import_path = fs::canonicalize(file_path).map_err(|e| e.to_string())?.parent().unwrap().join(import_path);
|
||||
if visited_paths.contains(&full_import_path)
|
||||
{
|
||||
println!("--Already visited {}--", full_import_path.display());
|
||||
@ -330,9 +327,6 @@ fn resolve_imports(tokens: &mut Vec<Token>, functions: &mut Vec<Function>, file_
|
||||
}
|
||||
}
|
||||
}
|
||||
Err(e) => return Err(e.to_string()),
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return Err(format!("Expected an import location at {}:{}", line, col));
|
||||
|
Reference in New Issue
Block a user