diff --git a/src/nix/hive.rs b/src/nix/hive.rs index 7020723..a1cb734 100644 --- a/src/nix/hive.rs +++ b/src/nix/hive.rs @@ -39,7 +39,8 @@ impl HivePath { if let Some(osstr) = path.file_name() { if osstr == "flake.nix" { - let parent = path.parent().unwrap().to_str().unwrap(); + let parent = path.parent().unwrap().canonicalize().unwrap(); + let parent = parent.to_str().unwrap(); let uri = format!("path:{}", parent); return Self::Flake(uri); diff --git a/src/nix/tests/mod.rs b/src/nix/tests/mod.rs index 8ca478b..82068c1 100644 --- a/src/nix/tests/mod.rs +++ b/src/nix/tests/mod.rs @@ -8,6 +8,7 @@ use std::hash::Hash; use std::io::Write; use std::iter::{FromIterator, Iterator}; use std::ops::Deref; +use std::path::PathBuf; use tempfile::NamedTempFile; use tokio_test::block_on; @@ -148,7 +149,11 @@ fn test_parse_simple() { #[test] fn test_parse_flake() { - let hive_path = HivePath::Flake("path:./src/nix/tests/simple-flake".to_string()); + let flake_path = { + let p = PathBuf::from("./src/nix/tests/simple-flake"); + p.canonicalize().unwrap() + }; + let hive_path = HivePath::Flake(format!("path:{}", flake_path.to_str().unwrap())); let mut hive = Hive::new(hive_path).unwrap(); hive.set_show_trace(true);