summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Bridle <bridle.benjamin@gmail.com>2024-08-10 14:36:42 +1200
committerBen Bridle <bridle.benjamin@gmail.com>2024-08-10 14:37:02 +1200
commit516f5cf5edfb7a2c4a4f3571aa6ce692a476d582 (patch)
treee10c41eb868288ec173a0fe2a01b0e9ee7ee92f3
parent38d40a2c5d4b553f524d87755b8e2e0e47928b8a (diff)
downloadbedrock-pc-516f5cf5edfb7a2c4a4f3571aa6ce692a476d582.zip
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.
-rw-r--r--src/devices/file/bedrock_file_path.rs6
1 files changed, 3 insertions, 3 deletions
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<Self> {
#[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.