Skip to content

Commit

Permalink
added creating shortcut on windows desktop
Browse files Browse the repository at this point in the history
  • Loading branch information
Petr Gadorek committed Jul 31, 2024
1 parent 605a5d6 commit c8f7539
Show file tree
Hide file tree
Showing 4 changed files with 140 additions and 10 deletions.
116 changes: 113 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ edition = "2021"

[dependencies]
tokio = {version = "1.37.0", features=["full"]}
idf-im-lib = { git = "https://github.com/espressif/idf-im-lib.git", rev="9a7a3e4806b63ce9b1a49538772fbc9c5e00619a" }
idf-im-lib = { git = "https://github.com/espressif/idf-im-lib.git", rev="4e83b798add624f45479fd126e852ff8eaf952cd" }
clap = {version = "4.5", features = ["cargo", "derive", "color"]}
crossterm = "0.27.0"
dialoguer = { git = "https://github.com/Hahihula/dialoguer.git", branch = "folder-select", features = ["folder-select"] }
Expand Down
8 changes: 7 additions & 1 deletion locales/app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -172,4 +172,10 @@ wizard.after_install.config.saved:
cn: 配置已保存成功到 config.toml
wizard.after_install.config.save_failed:
en: Configuration save failed
cn: 配置保存失败
cn: 配置保存失败
wizard.after_install.desktop_shortcut.created:
en: Desktop shortcut created successfully
cn: 已创建 desktop 快捷方式
wizard.after_install.desktop_shortcut.failed:
en: Failed to create desktop shortcut
cn: 创建 desktop 快捷方式失败
24 changes: 19 additions & 5 deletions src/wizard/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -754,14 +754,28 @@ pub async fn run_wizzard_run(mut config: Settings) -> Result<(), String> {
let export_paths =
get_tools_export_paths(tools, &target, tool_install_directory.to_str().unwrap());

#[cfg(windows)]
if std::env::consts::OS == "windows" {
for p in export_paths {
let _ = idf_im_lib::win_tools::add_to_win_path(&p);
}
// for p in export_paths {
// let _ = idf_im_lib::win_tools::add_to_win_path(&p);
// }
println!("{}", t!("wizard.windows.succes_message"));
// Creating desktop shortcut
match idf_im_lib::create_desktop_shortcut(
instalation_path.to_str().unwrap(),
idf_path.to_str().unwrap(),
tool_install_directory.to_str().unwrap(),
) {
Ok(_) => info!("{}", t!("wizard.after_install.desktop_shortcut.created")),
Err(err) => {
error!(
"{} {:?}",
t!("wizard.after_install.desktop_shortcut.failed"),
err.to_string()
)
}
}
}
#[cfg(not(windows))]

if std::env::consts::OS != "windows" {
let exports = env_vars
.into_iter()
Expand Down

0 comments on commit c8f7539

Please sign in to comment.