diff options
author | Ben Bridle <bridle.benjamin@gmail.com> | 2024-08-04 13:09:04 +1200 |
---|---|---|
committer | Ben Bridle <bridle.benjamin@gmail.com> | 2024-08-04 13:09:04 +1200 |
commit | b82ffe72b3f72b8fc5e42464319bab69973c097f (patch) | |
tree | 48943a581f80c95d4bdec4db0dfd5d9a32cbb2b6 /src/devices/file | |
parent | 8824a2fdc6f046006945deb8e5ef7a7d5173c139 (diff) | |
download | bedrock-pc-b82ffe72b3f72b8fc5e42464319bab69973c097f.zip |
Fix compilation on Linux
Some Windows-only library functions were added in during a previous
commit while I was developing on Windows.
Diffstat (limited to 'src/devices/file')
-rw-r--r-- | src/devices/file/directory_listing.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/devices/file/directory_listing.rs b/src/devices/file/directory_listing.rs index 6d669e5..341f353 100644 --- a/src/devices/file/directory_listing.rs +++ b/src/devices/file/directory_listing.rs @@ -21,6 +21,9 @@ impl DirectoryListing { }; let entry = continue_on_err!(entry_result); let path = continue_on_err!(remove_base(&entry.path(), &base)); + #[cfg(target_family = "unix")] + let byte_path = path.as_os_str().as_bytes(); + #[cfg(target_family = "windows")] let byte_path = path.as_os_str().as_encoded_bytes(); if byte_path.len() > 255 { continue; @@ -107,6 +110,9 @@ pub fn remove_base(absolute_path: &Path, base_path: &Path) -> Result<PathBuf, () // Returns true if a dot character directly follows the right-most // forward-slash character in the path. fn filename_dot_prefixed(path: &Path) -> bool { + #[cfg(target_family = "unix")] + let bytes = path.as_os_str().as_bytes(); + #[cfg(target_family = "windows")] let bytes = path.as_os_str().as_encoded_bytes(); // Find position of final forward-slash byte. let mut final_slash = None; |