Skip to content

Commit

Permalink
fix: the get_version command has no date
Browse files Browse the repository at this point in the history
  • Loading branch information
lgou2w committed May 19, 2023
1 parent 5a4d290 commit 0cfd753
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src-tauri/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ pub fn get_handlers<R: Runtime>() -> Box<dyn Fn(Invoke<R>) + Send + Sync> {

#[tauri::command]
fn get_version() -> String {
let date = constants::COMMIT_DATE.split('T').collect::<Vec<&str>>()[0];
let commit_tag = constants::COMMIT_TAG;
if !commit_tag.is_empty() && commit_tag.to_lowercase().contains("snapshot") {
return commit_tag.to_owned()
format!("{} ({})", commit_tag, date)
} else {
format!("{}-{} ({})",
constants::VERSION,
constants::COMMIT_HASH[0..7].to_owned(),
date
)
}

format!("{}-{} ({})",
constants::VERSION,
constants::COMMIT_HASH[0..7].to_owned(),
constants::COMMIT_DATE.split('T').collect::<Vec<&str>>()[0]
)
}

0 comments on commit 0cfd753

Please sign in to comment.