Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix stripping EXE_EXTENSION instead of EXE_SUFFIX #10

Merged
merged 1 commit into from
Apr 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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