mirror of
https://github.com/edera-dev/sprout.git
synced 2026-11-04 17:52:20 +00:00
fix(autoconfigure): don't treat an empty BLS entries directory as BLS
BLS was detected when reading \loader\entries produced any item, but a FAT directory always lists "." first, so an empty entries directory counted as having entries. On an ESP with a leftover empty entries directory, Linux autoconfiguration was skipped and no Linux entries were shown. Only count the directory when it has a .conf file.
This commit is contained in:
1 parent
133247c05a
commit
b4e765279b
1 file changed
+14
-4
@@ -46,12 +46,22 @@ pub fn scan(
|
||||
.context("unable to check for BLS loader.conf file")?;
|
||||
|
||||
// Whether we have an entries directory.
|
||||
// We actually iterate the entries to see if there are any.
|
||||
// We actually iterate the entries to see if there are any entry files, as the
|
||||
// directory itself always has the "." and ".." items, even when it is empty.
|
||||
let has_entries_dir = filesystem
|
||||
.read_dir(bls_entries_path)
|
||||
.ok()
|
||||
.and_then(|mut iterator| iterator.next())
|
||||
.map(|entry| entry.is_ok())
|
||||
.map(|mut iterator| {
|
||||
iterator.any(|entry| {
|
||||
entry.is_ok_and(|entry| {
|
||||
entry.is_regular_file()
|
||||
&& entry
|
||||
.file_name()
|
||||
.to_string()
|
||||
.to_lowercase()
|
||||
.ends_with(".conf")
|
||||
})
|
||||
})
|
||||
})
|
||||
.unwrap_or(false);
|
||||
|
||||
// Detect if a BLS supported configuration is on this filesystem.
|
||||
|
||||
Reference in new issue
Block a user