We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f4c7254 commit c531c00Copy full SHA for c531c00
graph/src/components/link_resolver/file.rs
@@ -39,13 +39,11 @@ impl FileLinkResolver {
39
fn resolve_path(&self, link: &str) -> PathBuf {
40
let path = Path::new(link);
41
42
- // If the path is already absolute or if we don't have a base_dir, return it as is
43
- if path.is_absolute() || self.base_dir.is_none() {
44
- path.to_owned()
45
- } else {
46
- // Otherwise, join with base_dir
47
- self.base_dir.as_ref().unwrap().join(link)
48
- }
+ // Return the path as is if base_dir is None, or join with base_dir if present.
+ // if "link" is an absolute path, join will simply return that path.
+ self.base_dir
+ .as_ref()
+ .map_or_else(|| path.to_owned(), |base_dir| base_dir.join(link))
49
}
50
51
0 commit comments