Skip to content

Commit 33a9eca

Browse files
author
wanglt
committed
feat:check dir exist
1 parent 3fe3950 commit 33a9eca

3 files changed

Lines changed: 9 additions & 5 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,5 @@ apps/desktop/frontend/.tanstack/
3636
apps/desktop/.task/
3737
apps/desktop/bin/
3838
apps/docs/.next/
39+
apps/client/echplus-client
40+
apps/client/.echplus/

apps/client/core/core.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -402,10 +402,6 @@ func downloadIPList(urlStr, filePath string) error {
402402
func (s *ProxyServer) loadChinaIPList() error {
403403

404404
ipListFile := filepath.Join(s.config.StoreDir, "chn_ip.txt")
405-
fmt.Println("ipListFile", ipListFile)
406-
// if _, err := os.Stat(ipListFile); os.IsNotExist(err) {
407-
// ipListFile = "chn_ip.txt"
408-
// }
409405
needDownload := false
410406
if info, err := os.Stat(ipListFile); os.IsNotExist(err) {
411407
needDownload = true

apps/client/main.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,13 @@ func main() {
5050
if err != nil {
5151
log.Fatal("获取可执行文件路径失败: %w", err)
5252
}
53-
StoreDir := filepath.Join(exePath, ".echplus")
53+
exeDir := filepath.Dir(exePath)
54+
StoreDir := filepath.Join(exeDir, ".echplus")
55+
56+
// 确保存储目录存在
57+
if err := os.MkdirAll(StoreDir, 0755); err != nil {
58+
log.Fatalf("创建存储目录失败: %v", err)
59+
}
5460
cfg := core.Config{
5561
ListenAddr: listenAddr,
5662
ServerAddr: serverAddr,

0 commit comments

Comments
 (0)