From 7c237209207cd2938df660b6fd87d3b7d728bd03 Mon Sep 17 00:00:00 2001 From: Guilherme Oenning Date: Fri, 12 May 2023 13:36:31 +0100 Subject: [PATCH] feat: add `tauri::version`, similar to `getTauriVersion` available on JS API (#6546) Signed-off-by: goenning Apply suggestions from code review --- .changes/add-tauri-get-version.md | 5 +++++ core/tauri/src/lib.rs | 5 +++++ 2 files changed, 10 insertions(+) create mode 100644 .changes/add-tauri-get-version.md diff --git a/.changes/add-tauri-get-version.md b/.changes/add-tauri-get-version.md new file mode 100644 index 000000000..b051a62dc --- /dev/null +++ b/.changes/add-tauri-get-version.md @@ -0,0 +1,5 @@ +--- +"tauri": "patch" +--- + +Added `tauri::version` function to retrieve Tauri's version from Rust. diff --git a/core/tauri/src/lib.rs b/core/tauri/src/lib.rs index f064029d9..79b31e1eb 100644 --- a/core/tauri/src/lib.rs +++ b/core/tauri/src/lib.rs @@ -326,6 +326,11 @@ pub trait Runtime: runtime::Runtime {} impl> Runtime for W {} +/// Returns Tauri version. +pub fn version() -> &'static str { + env!("CARGO_PKG_VERSION") +} + /// Reads the config file at compile time and generates a [`Context`] based on its content. /// /// The default config file path is a `tauri.conf.json` file inside the Cargo manifest directory of