From 516f5cf5edfb7a2c4a4f3571aa6ce692a476d582 Mon Sep 17 00:00:00 2001 From: Ben Bridle Date: Sat, 10 Aug 2024 14:36:42 +1200 Subject: Fix ascend-to-parent behaviour of file device We were finding the parent of the relative path and then passing this to the BedrockFilePath::from_path constructor, but this constructor expects to be passed an absolute path and so was unconditionally returning None. --- src/devices/file/bedrock_file_path.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/devices/file/bedrock_file_path.rs') diff --git a/src/devices/file/bedrock_file_path.rs b/src/devices/file/bedrock_file_path.rs index e083853..1c702de 100644 --- a/src/devices/file/bedrock_file_path.rs +++ b/src/devices/file/bedrock_file_path.rs @@ -65,15 +65,15 @@ impl BedrockFilePath { /// Get a path which represents the parent of this path. pub fn parent(&self) -> Option { #[cfg(target_family = "unix")] { - Self::from_path(self.relative.parent()?, &self.base) + Self::from_path(self.as_path().parent()?, &self.base) } #[cfg(target_family = "windows")] { if self.base.components().count() != 0 { // Sandboxed path, cannot ascend to a virtual root directory. - Self::from_path(self.relative.parent()?, &self.base) + Self::from_path(self.as_path().parent()?, &self.base) } else { // Unsandboxed path, we can ascend to a virtual root directory. - match self.relative.parent() { + match self.as_path().parent() { // Ascend to concrete parent directory. Some(parent) => Self::from_path(parent, &self.base), // Ascend into a virtual root directory. -- cgit v1.2.3-70-g09d2