Skip to content

Commit 9776177

Browse files
committed
Update
1 parent 30c173b commit 9776177

File tree

5 files changed

+9
-12
lines changed

5 files changed

+9
-12
lines changed

crates/parser/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "mxmlextrema-as3parser"
3-
version = "1.5.1"
3+
version = "1.5.2"
44
edition = "2021"
55
authors = ["Matheus Dias de Souza <hydroperfox@gmail.com>"]
66
repository = "https://github.com/mxmlextrema/as3parser"

crates/parser/compilation_unit/compilation_unit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,5 +249,5 @@ impl CompilationUnit {
249249
}
250250

251251
fn canonicalize_path(path: &str) -> String {
252-
std::path::Path::new(path).canonicalize().unwrap_or_else(|_| std::path::PathBuf::new()).to_string_lossy().into_owned()
252+
realhydroper_path::canonicalize_inexistent_path(std::path::Path::new(path)).to_string_lossy().into_owned()
253253
}

crates/parser/parser/parser.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3692,11 +3692,11 @@ impl<'input> Parser<'input> {
36923692
} else {
36933693
// Read included content
36943694

3695-
let sub_file_path_pathbuf = sub_flex_file_path.to_path_buf().canonicalize().unwrap_or(PathBuf::new());
3695+
let sub_file_path_pathbuf = realhydroper_path::canonicalize_inexistent_path(&sub_flex_file_path.to_path_buf());
36963696
let mut replaced = false;
36973697

36983698
for (replace_file_path, content) in self.replace_included_content.read().unwrap().iter() {
3699-
if sub_file_path_pathbuf == replace_file_path.canonicalize().unwrap() {
3699+
if sub_file_path_pathbuf == realhydroper_path::canonicalize_inexistent_path(&replace_file_path) {
37003700
nested_compilation_unit = Some(CompilationUnit::new(Some(sub_file_path_pathbuf.to_str().unwrap().to_owned()), content.clone()));
37013701
replaced = true;
37023702
break;

crates/parser_test/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ path = "main.rs"
1616

1717
[dependencies]
1818
clap = { version = "4.4.8", features = ["derive"] }
19-
hydroperfox-filepaths = "1.0.0"
19+
realhydroper-path = "1"
2020
mxmlextrema-as3parser = { path = "../parser", version = "1" }
2121
maplit = "1.0.2"
2222
serde = { version = "1.0.192", features = ["rc", "derive"] }

crates/parser_test/main.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use clap::Parser;
2-
use hydroperfox_filepaths::FlexPath;
2+
use realhydroper_path::FlexPath;
33
use std::{env, fs, io};
44
use mxmlextrema_as3parser::ns::*;
55

@@ -21,13 +21,10 @@ struct Arguments {
2121

2222
fn main() -> io::Result<()> {
2323
let arguments = Arguments::parse();
24-
let source_path = FlexPath::from_n_native([env::current_dir().unwrap().to_string_lossy().into_owned().as_ref(), arguments.source_path.as_ref()]).to_string_with_flex_separator();
24+
let source_path = FlexPath::from_n_native([env::current_dir().unwrap().to_string_lossy().into_owned().as_ref(), arguments.source_path.as_ref()]).to_string();
2525

26-
// Canonicalize path
27-
// let source_path = std::path::Path::new(&source_path).canonicalize().unwrap().to_string_lossy().into_owned();
28-
29-
let source_path_ast_json = FlexPath::new_native(&source_path).change_extension(".tree").to_string_with_flex_separator();
30-
let source_path_diagnostics = FlexPath::new_native(&source_path).change_extension(".diag").to_string_with_flex_separator();
26+
let source_path_ast_json = FlexPath::new_native(&source_path).change_extension(".tree").to_string();
27+
let source_path_diagnostics = FlexPath::new_native(&source_path).change_extension(".diag").to_string();
3128
let source_content = fs::read_to_string(&source_path)?;
3229
let compilation_unit = CompilationUnit::new(Some(source_path), source_content);
3330
if arguments.mxml {

0 commit comments

Comments
 (0)