Skip to content

Commit

Permalink
Merge pull request #25 from est31/main
Browse files Browse the repository at this point in the history
Fix for shorter if let lifetime
  • Loading branch information
kumavale authored Oct 21, 2023
2 parents e30f0a9 + a285709 commit f536ef9
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,12 +335,13 @@ fn build_app() -> App<'static, 'static> {

fn get_config_file_path() -> String {
#[cfg(windows)]
return format!("{}/sisterm/config.toml",
if let Ok(ref user) = env::var("LOCALAPPDATA") { user } else { "%LOCALAPPDATA%" } );

const VAR_AND_FALLBACK: (&str, &str) = ("LOCALAPPDATA", "%LOCALAPPDATA%");
#[cfg(not(windows))]
return format!("{}/.config/sisterm/config.toml",
if let Ok(ref home) = env::var("HOME") { home } else { "$HOME" } );
const VAR_AND_FALLBACK: (&str, &str) = ("HOME", "$HOME");
let var = env::var(VAR_AND_FALLBACK.0);

format!("{}/sisterm/config.toml",
if let Ok(ref home) = var { home } else { VAR_AND_FALLBACK.1 })
}

fn config_file_help_message() -> &'static str {
Expand Down

0 comments on commit f536ef9

Please sign in to comment.