Skip to content

Commit 3e88a69

Browse files
committed
try globwalk
1 parent bf06073 commit 3e88a69

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

src/compiler.rs

+27-2
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,35 @@ impl Compiler {
7979
let has_glob = import_base_str.find('*').is_some();
8080

8181
if has_glob {
82+
let walker = globwalk::glob_builder(import_base_str)
83+
.build()
84+
.map_err(|_err| Error::ImportGlob {
85+
error: "FIX ERR".to_string(),
86+
path: *path,
87+
})?;
88+
for maybe_entry in walker {
89+
let Ok(entry) = maybe_entry else { continue };
90+
let import = entry.path().to_owned();
91+
println!("IMPORT: {}", import.display());
92+
93+
if import.is_file() {
94+
if current.file_path.contains(&import) {
95+
return Err(Error::CircularImport {
96+
current: current.path,
97+
import,
98+
});
99+
}
100+
absolute_paths.push(import.clone());
101+
stack.push(current.import(import, path.offset));
102+
}
103+
}
104+
105+
/*
82106
let glob = globset::Glob::new(&import_base_str).map_err(|_err|
83107
Error::ImportGlob { error: "FIX ERR".to_string(), path: *path }
84108
)?.compile_matcher();
85-
/*
109+
*/
110+
/*
86111
87112
let glob_options = glob::MatchOptions {
88113
case_sensitive: true,
@@ -364,7 +389,7 @@ x:
364389
#[test]
365390
fn invalid_glob_imports() {
366391
let justfile = r#"
367-
import "./subdir/***.just"
392+
import "./subdir/****.just"
368393
"#;
369394
let tmp = temptree! {
370395
justfile: justfile,

0 commit comments

Comments
 (0)