fix: if i18n file exist, try to replace it when init. #95

This commit is contained in:
LinkinStar
2022-11-24 11:59:19 +08:00
parent 661d8a7f8f
commit 18e062623e
+7
View File
@@ -2,6 +2,7 @@ package cli
import (
"fmt"
"os"
"path/filepath"
"github.com/answerdev/answer/configs"
@@ -96,6 +97,12 @@ func installI18nBundle() {
if err != nil {
continue
}
if dir.CheckFileExist(path) {
fmt.Printf("[i18n] install %s file exist, try to replace it\n", item.Name())
if err = os.Remove(path); err != nil {
fmt.Println(err)
}
}
fmt.Printf("[i18n] install %s bundle...\n", item.Name())
err = writer.WriteFile(path, string(content))
if err != nil {