Skip to content

Commit ea2bc2a

Browse files
committed
fix: fix shortcut file check to handle deleted shortcuts with existing bat files (#134)
1 parent d574f15 commit ea2bc2a

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

run/run.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,13 @@ func CreateRepo(siteName string, needStart bool, diff string, providerName strin
8989
}
9090
}
9191

92-
batExisted, err := updateBatFile(siteName)
92+
_, err = updateBatFile(siteName)
9393
if err != nil {
9494
return wrapRepoError("updateBatFile", path, err)
9595
}
9696

97-
if !batExisted {
97+
shortcutPath := getShortcutPath(siteName)
98+
if !util.FileExist(shortcutPath) {
9899
err = updateShortcutFile(siteName)
99100
if err != nil {
100101
return wrapRepoError("updateShortcutFile", path, err)
@@ -147,12 +148,13 @@ func CreateRepo(siteName string, needStart bool, diff string, providerName strin
147148
}
148149
}
149150

150-
batExisted, err := updateBatFile(siteName)
151+
_, err = updateBatFile(siteName)
151152
if err != nil {
152153
return wrapRepoError("updateBatFile", path, err)
153154
}
154155

155-
if !batExisted {
156+
shortcutPath := getShortcutPath(siteName)
157+
if !util.FileExist(shortcutPath) {
156158
err = updateShortcutFile(siteName)
157159
if err != nil {
158160
return wrapRepoError("updateShortcutFile", path, err)

run/self.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,13 @@ func InitSelfStart() {
3737
panic("InitSelfStart() error, siteName should not be empty")
3838
}
3939

40-
batExisted, err := updateBatFile(siteName)
40+
_, err := updateBatFile(siteName)
4141
if err != nil {
4242
panic(err)
4343
}
4444

45-
if !batExisted {
45+
shortcutPath := getShortcutPath(siteName)
46+
if !util.FileExist(shortcutPath) {
4647
err = updateShortcutFile(siteName)
4748
if err != nil {
4849
panic(err)

0 commit comments

Comments
 (0)