mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-27 11:07:44 +00:00
hashsum: use file_stem() instead of file_name()
This program matches the binary name to determine which algorithm to use. On Windows, `file_name()` was matching against a string with `.exe`, causing binaries like `sha256sum.exe` to not properly detect the algorithm. By using `file_stem()`, we exclude the `.exe` from matching, achieving similar and correct behavior on Windows.
This commit is contained in:
parent
5c10180f6d
commit
a7f95d5a23
1 changed files with 1 additions and 1 deletions
|
@ -306,7 +306,7 @@ pub fn uumain(mut args: impl uucore::Args) -> UResult<()> {
|
|||
// if there is no program name for some reason, default to "hashsum"
|
||||
let program = args.next().unwrap_or_else(|| OsString::from(NAME));
|
||||
let binary_name = Path::new(&program)
|
||||
.file_name()
|
||||
.file_stem()
|
||||
.unwrap_or_else(|| OsStr::new(NAME))
|
||||
.to_string_lossy();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue