Skip to content

Commit e5a45e1

Browse files
committed
fix globbing not working from non-project root directory
1 parent a2f998d commit e5a45e1

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

lib/icp-project/src/lib.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use camino::{Utf8Path, Utf8PathBuf};
22
use serde::Deserialize;
3-
use snafu::{ResultExt, Snafu};
3+
use snafu::{OptionExt, ResultExt, Snafu};
44

55
use icp_fs::yaml::{LoadYamlFileError, load_yaml_file};
66

@@ -42,7 +42,12 @@ impl ProjectManifest {
4242
let mut cs = Vec::new();
4343

4444
for pattern in pm.canisters {
45-
let matches = glob::glob(pattern.as_str()).context(GlobPatternSnafu { pattern })?;
45+
let mdir = mpath
46+
.parent()
47+
.context(ProjectDirectorySnafu { path: mpath })?;
48+
49+
let matches =
50+
glob::glob(mdir.join(&pattern).as_str()).context(GlobPatternSnafu { pattern })?;
4651

4752
for cpath in matches {
4853
let cpath = cpath.context(GlobWalkSnafu { path: mpath })?;
@@ -66,6 +71,9 @@ impl ProjectManifest {
6671

6772
#[derive(Debug, Snafu)]
6873
pub enum LoadProjectManifestError {
74+
#[snafu(display("failed to find project directory for project manifest {path}"))]
75+
ProjectDirectory { path: Utf8PathBuf },
76+
6977
#[snafu(transparent)]
7078
Parse { source: LoadYamlFileError },
7179

0 commit comments

Comments
 (0)