Skip to content

Commit aa81602

Browse files
committed
feat (core): 支持加载系统默认环境
1 parent a78acf4 commit aa81602

3 files changed

Lines changed: 48 additions & 1 deletion

File tree

src-tauri/Cargo.lock

Lines changed: 38 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src-tauri/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ tauri-build = { version = "2", features = [] }
1414
chrono = { version = "0.4.41", features = ["serde"] }
1515

1616
[dependencies]
17-
tauri = { version = "2", features = [ "devtools"] }
17+
tauri = { version = "2", features = ["devtools"] }
1818
tauri-plugin-opener = "2"
1919
tauri-plugin-shell = "2.0"
2020
tauri-plugin-dialog = "2.0"
@@ -32,3 +32,4 @@ regex = "1.11.1"
3232
reqwest = { version = "0.11", features = ["json", "stream"] }
3333
futures-util = "0.3"
3434
rfd = "0.15"
35+
fix-path-env = { git = "https://github.com/tauri-apps/fix-path-env-rs" }

src-tauri/src/main.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ use plugins::PluginManager;
3131
use update::{check_for_updates, start_update};
3232

3333
fn main() {
34+
// 设置系统环境变量
35+
let _ = fix_path_env::fix();
36+
3437
tauri::Builder::default()
3538
.plugin(tauri_plugin_shell::init())
3639
.plugin(tauri_plugin_dialog::init())
@@ -54,6 +57,11 @@ fn main() {
5457
let menu = setup::menu::create_menu(app.handle())?;
5558
app.set_menu(menu)?;
5659
setup::menu::setup_menu_handler(app.handle());
60+
61+
info!(
62+
"初始化 -> 系统环境变量 {:?}",
63+
std::env::var(String::from("PATH")).unwrap_or(String::from(""))
64+
);
5765
Ok(())
5866
})
5967
.invoke_handler(tauri::generate_handler![

0 commit comments

Comments
 (0)