(args: &TaskArgs)
| 120 | |
| 121 | #[cfg(windows)] |
| 122 | pub fn create(args: &TaskArgs) -> Result<()> { |
| 123 | let path = dirs::desktop_dir() |
| 124 | .ok_or(anyhow!("找不到桌面路径。"))? |
| 125 | .join("Visual Studio Code.lnk"); |
| 126 | if path.exists() { |
| 127 | warn!("快捷方式 {:?} 已存在,将被覆盖。", path); |
| 128 | } |
| 129 | // Use exe instead of cmd, for showing vscode icon |
| 130 | let vscode_exe = Some(&args.vscode) |
| 131 | .and_then(|p| p.parent()) |
| 132 | .and_then(|p| p.parent()) |
| 133 | .unwrap() |
| 134 | .join("Code.exe") |
| 135 | .to_string(); |
| 136 | create_lnk( |
| 137 | path.to_str().unwrap(), |
| 138 | &vscode_exe, |
| 139 | &format!("Open VS Code at {}", args.workspace.to_string()), |
| 140 | &format!("\"{}\"", args.workspace.to_string()), |
| 141 | )?; |
| 142 | Ok(()) |
| 143 | } |
| 144 | |
| 145 | #[cfg(not(windows))] |
| 146 | pub fn create(_args: &TaskArgs) -> Result<()> { |
no test coverage detected