diff options
author | Matthias Beyer <matthias.beyer@atos.net> | 2021-08-24 13:06:47 +0200 |
---|---|---|
committer | Matthias Beyer <matthias.beyer@atos.net> | 2021-08-26 12:30:25 +0200 |
commit | 2a7602f419bb0566a9873acc1e73d2e3bd27bc72 (patch) | |
tree | 97ab239dccf665723754702c4572bfb3a93b1599 | |
parent | 4defd24f134cc657dafec4b3925097fe977a36cd (diff) |
Fix: Do not push the full (absolute) path but only the relative one
Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
-rw-r--r-- | src/repository/fs.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/repository/fs.rs b/src/repository/fs.rs index 4cf1829..32b7e6e 100644 --- a/src/repository/fs.rs +++ b/src/repository/fs.rs @@ -103,14 +103,15 @@ impl FileSystemRepresentation { .map_err(Error::from) .and_then_ok(|de| { let mut curr_hm = &mut fsr.elements; - fsr.files.push(de.path().to_path_buf()); + let de_path = de.path().strip_prefix(&fsr.root)?; + fsr.files.push(de_path.to_path_buf()); // traverse the HashMap tree - for cmp in de.path().components() { + for cmp in de_path.components() { match PathComponent::try_from(&cmp)? { PathComponent::PkgToml => { curr_hm.entry(PathComponent::PkgToml) - .or_insert(Element::File(load_file(de.path())?)); + .or_insert(Element::File(load_file(de_path)?)); }, dir @ PathComponent::DirName(_) => { curr_hm.entry(dir.clone()) |