Skip to content

Commit

Permalink
fix: not work if space in path
Browse files Browse the repository at this point in the history
  • Loading branch information
amorphobia committed Sep 17, 2024
1 parent ec86301 commit d5b3bf8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 6 additions & 4 deletions Lib/RabbitTrayMenu.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ SetupTrayMenu()
UpdateTrayIcon()

SetupTrayMenu() {
static rabbit_script := Format("`"{}\Rabbit.ahk`"", A_ScriptDir)
static rabbit_ico := Format("{}\Lib\rabbit.ico", A_ScriptDir)
A_TrayMenu.Delete()
; A_TrayMenu.Add("输入法设定")
; A_TrayMenu.Add("用户词典管理")
Expand All @@ -44,9 +46,9 @@ SetupTrayMenu() {
if FileExist(A_Startup . "\Rabbit.lnk") {
A_TrayMenu.Add("从开机启动删除", (*) => (FileDelete(A_Startup . "\Rabbit.lnk"), SetupTrayMenu()))
} else {
A_TrayMenu.Add("添加到开机启动", (*) => (FileCreateShortcut(A_AhkPath, A_Startup . "\Rabbit.lnk", A_ScriptDir, A_ScriptDir . "\Rabbit.ahk", "玉兔毫输入法", A_ScriptDir . "\Lib\rabbit.ico"), SetupTrayMenu()))
A_TrayMenu.Add("添加到开机启动", (*) => (FileCreateShortcut(A_AhkPath, A_Startup . "\Rabbit.lnk", A_ScriptDir, rabbit_script, "玉兔毫输入法", rabbit_ico), SetupTrayMenu()))
}
A_TrayMenu.Add("添加到桌面快捷方式", (*) => (FileCreateShortcut(A_AhkPath, A_Desktop . "\Rabbit.lnk", A_ScriptDir, A_ScriptDir . "\Rabbit.ahk", "玉兔毫输入法", A_ScriptDir . "\Lib\rabbit.ico"), SetupTrayMenu()))
A_TrayMenu.Add("添加到桌面快捷方式", (*) => FileCreateShortcut(A_AhkPath, A_Desktop . "\Rabbit.lnk", A_ScriptDir, rabbit_script, "玉兔毫输入法", rabbit_ico))

A_TrayMenu.Add()

Expand All @@ -66,11 +68,11 @@ SetupTrayMenu() {
}

Sync() {
Run(A_AhkPath . " " . A_ScriptDir . "\RabbitDeployer.ahk sync 1")
Run(Format("{} `"{}\RabbitDeployer.ahk`" sync 1", A_AhkPath, A_ScriptDir))
ExitApp()
}
Deploy() {
Run(A_AhkPath . " " . A_ScriptDir . "\RabbitDeployer.ahk deploy 1")
Run(Format("{} `"{}\RabbitDeployer.ahk`" deploy 1", A_AhkPath, A_ScriptDir))
ExitApp()
}
ToggleSuspend() {
Expand Down
4 changes: 1 addition & 3 deletions RabbitDeployer.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ RunDeployer(args) {
}

if args.Length > 1 {
sp := " "
target := A_AhkPath . sp . A_ScriptDir . "\Rabbit.ahk"
Run(target . sp . opt . sp . String(res))
Run(Format("{} `"{}\Rabbit.ahk`" {} {}", A_AhkPath, A_ScriptDir, opt, res))
ExitApp()
}
return res
Expand Down

0 comments on commit d5b3bf8

Please sign in to comment.