Skip to content

Commit

Permalink
windows issues
Browse files Browse the repository at this point in the history
  • Loading branch information
guyutongxue committed Sep 6, 2022
1 parent 0ba6ce6 commit 9ee4dc9
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 11 deletions.
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# 更新日志

## v4.0.2

*2022.9.6*
- Mac 下现允许使用 .app 路径作为 vscode 路径

## v4.0.1
Expand Down Expand Up @@ -138,8 +138,8 @@
| GUI | Windows Form | Windows Form | Vue.js | Svelte.js |
| 可脱机运行 | ✔️ | ✔️ || ✔️ |
| 单文件应用 ||| ✔️ | ✔️ |
| 程序体积 (Windows) | 0.4M | 0.5M | 4.0M | 4.5M+ |
| 代码量(行) | 600+ | 1600+ | 2000+ | 3300+ |
| 程序体积 (Windows) | 0.4M | 0.5M | 4.0M | 7.7M |
| 代码量(行) | 600+ | 1600+ | 2000+ | 3800+ |

## [v3.x](https://github.com/VSCodeConfigHelper/v3/blob/main/CHANGELOG.md)

Expand Down
2 changes: 1 addition & 1 deletion docs/docs/macos.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

如果你将 VS Code “安装”在了“应用程序”文件夹中,或者在 VS Code 中执行过“在 PATH 中安装 'code' 命令”,则工具可以自动显示你的 VS Code 安装路径。此时点击下一步即可。如果你不能点击下一步,你需要进行如下操作之一:
- 在 VS Code 中执行“在 PATH 中安装 'code' 命令”。具体步骤是,打开 VS Code,并按 Command + Shift + P 呼出命令菜单,搜索“Shell 命令:在 PATH 中安装 'code' 命令”并执行。执行完成后,重新运行本工具。
- 手动输入 VS Code 可执行文件的路径,默认位于 .app 路径下的 `Contents/Resources/app/bin/code`
- 手动输入 VS Code .app 路径或二进制文件路径

### 编译器选择

Expand Down
2 changes: 1 addition & 1 deletion src-tauri/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 src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "vscch"
version = "4.0.1"
version = "4.0.2"
description = "VS Code Config Helper v4"
authors = ["Guyutongxue"]
license = "GPLv3"
Expand Down
23 changes: 18 additions & 5 deletions src-tauri/src/tasks/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,16 @@ mod shortcut {
if path.exists() {
warn!("快捷方式 {:?} 已存在,将被覆盖。", path);
}
// Use exe instead of cmd, for showing vscode icon
let vscode_exe = Some(&args.vscode)
.and_then(|p| p.parent())
.and_then(|p| p.parent())
.unwrap()
.join("Code.exe")
.to_string();
create_lnk(
path.to_str().unwrap(),
args.vscode.to_str().unwrap(),
&vscode_exe,
&format!("Open VS Code at {}", args.workspace.to_string()),
&format!("\"{}\"", args.workspace.to_string()),
)?;
Expand All @@ -142,7 +149,11 @@ mod shortcut {
}

mod vscode {
use super::*;
use std::os::windows::process::CommandExt;

use crate::utils::winapi::CREATE_NO_WINDOW;

use super::*;

pub fn open(args: &TaskArgs) -> Result<()> {
let mut vscode_args = vec![args.workspace.to_str().expect("to_str err")];
Expand All @@ -151,9 +162,11 @@ mod vscode {
vscode_args.push(test_file.as_str());
}
trace!("Open command: {:?} {:?}", args.vscode, vscode_args);
std::process::Command::new(&args.vscode)
.args(vscode_args)
.spawn()?;

let mut cmd = std::process::Command::new(&args.vscode);
#[cfg(windows)]
cmd.creation_flags(CREATE_NO_WINDOW);
cmd.args(vscode_args).spawn()?;
Ok(())
}
}
Expand Down

0 comments on commit 9ee4dc9

Please sign in to comment.