mirror of
https://github.com/edera-dev/sprout.git
synced 2025-12-19 10:10:17 +00:00
fix(eficore/env): improve quirk handling for dell systems
This commit is contained in:
@@ -45,25 +45,17 @@ pub fn args() -> Result<Vec<String>> {
|
|||||||
|
|
||||||
// Correct firmware that may add invalid arguments at the start.
|
// Correct firmware that may add invalid arguments at the start.
|
||||||
// Witnessed this on a Dell Precision 5690 when direct booting.
|
// Witnessed this on a Dell Precision 5690 when direct booting.
|
||||||
loop {
|
args = args
|
||||||
// Grab the first argument or break.
|
.into_iter()
|
||||||
let Some(arg) = args.first() else {
|
.skip_while(|arg| {
|
||||||
break;
|
arg.chars()
|
||||||
};
|
.next()
|
||||||
|
// Filter out unprintable characters and backticks.
|
||||||
// Check if the argument is a valid character.
|
// Both of which have been observed in the wild.
|
||||||
// If it is not, remove it and continue.
|
.map(|c| c < 0x1f as char || c == '`')
|
||||||
let Some(first_character) = arg.chars().next() else {
|
.unwrap_or(false)
|
||||||
break;
|
})
|
||||||
};
|
.collect();
|
||||||
|
|
||||||
// If the character is not a printable character or a backtick, remove it and continue.
|
|
||||||
if first_character < 0x1f as char || first_character == '`' {
|
|
||||||
args.remove(0);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If there is a first argument, check if it is not an option.
|
// If there is a first argument, check if it is not an option.
|
||||||
// If it is not, we will assume it is the path to the executable and remove it.
|
// If it is not, we will assume it is the path to the executable and remove it.
|
||||||
|
|||||||
Reference in New Issue
Block a user