Skip to content

Commit

Permalink
Fix stripping EXE_EXTENSION instead of EXE_SUFFIX (#10)
Browse files Browse the repository at this point in the history
Thank you for fixing this!!
  • Loading branch information
kennethloeffler authored Apr 23, 2024
1 parent dfdfc12 commit ae446a4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/system/current.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use std::{
env::{self, consts::EXE_EXTENSION},
env::{self, consts::EXE_SUFFIX},
path::PathBuf,
};

Expand Down Expand Up @@ -57,11 +57,11 @@ pub fn current_exe_name() -> String {

// NOTE: Shells on Windows can be weird sometimes and pass arg0
// using either a lowercase or uppercase extension, so we fix that
let exe_name = if EXE_EXTENSION.is_empty() {
let exe_name = if EXE_SUFFIX.is_empty() {
exe_name
} else {
let suffix_lower = EXE_EXTENSION.to_ascii_lowercase();
let suffix_upper = EXE_EXTENSION.to_ascii_uppercase();
let suffix_lower = EXE_SUFFIX.to_ascii_lowercase();
let suffix_upper = EXE_SUFFIX.to_ascii_uppercase();
if let Some(stripped) = exe_name.strip_suffix(&suffix_lower) {
stripped
} else if let Some(stripped) = exe_name.strip_suffix(&suffix_upper) {
Expand Down

0 comments on commit ae446a4

Please sign in to comment.