Conversation
friendly_app_name only treated exe:-prefixed identifiers as paths, but openlogi-hook's Windows ForegroundApp::id is a bare lower-cased full executable path with no such prefix. Its dot rule returned the segment after the last '.' for any identifier, so every Windows profile row was labelled 'exe'. Fixes AprilNEA#1403
|
| let stem = name | ||
| .len() | ||
| .checked_sub(4) | ||
| .filter(|&i| name[i..].eq_ignore_ascii_case(".exe")) | ||
| .map_or(name, |i| &name[..i]); | ||
| return stem.to_string(); |
There was a problem hiding this comment.
If a Windows executable uses another valid extension, such as c:\tools\app.com, this branch returns app.com. The Windows hook and other executable-name handling use Path::file_stem() and would return app, so the profile label can differ depending on whether the application was observed during the current session. Please derive the final component's stem consistently rather than removing only .exe.
Summary
Changes
crates/openlogi-desktop/src/features/profiles.rs:friendly_app_nameonly treatedexe:-prefixed identifiers as paths.openlogi-hook's WindowsForegroundApp::id(crates/openlogi-hook/src/windows/hook.rs) is the bare lower-cased full executable path with no such prefix, so the function's dot-splitting fallback returned the segment after the last.for every Windows identifier — alwaysexe. Now any identifier containing a path separator or ending in.exe(case-insensitively) is treated as a path and resolved to its file stem, whether or not it carries theexe:prefix.Testing
cargo test -p openlogi-desktop(addsa_raw_windows_path_with_no_exe_prefix_still_resolves_to_the_stem, keeps the existingexe:-prefixed and bundle-id cases green)cargo fmt --all -- --checkcargo clippy -p openlogi-desktop --all-targets -- -D warningsForegroundApp::id's construction inopenlogi-hook.Fixes #1403