Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a037e55

Browse files
committed
Merge branch 'main' of github.com:ctfang/mysql-binlog-ui
2 parents 4bf060a + f7096a7 commit a037e55

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

apps/datas/paths.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package datas
22

33
import (
44
"os"
5+
"path"
56
"path/filepath"
67
"runtime"
78
"strings"
@@ -36,9 +37,14 @@ func GetDataDir(appName string) (string, error) {
3637
}
3738

3839
// GetPath 根据系统类型, 返回对应保存数据的目录
39-
func GetPath(path string) string {
40-
dir, _ := GetDataDir("mysql-binlog-ui/" + path)
41-
return strings.ReplaceAll(dir, "//", "/")
40+
func GetPath(filePath string) string {
41+
dir, _ := GetDataDir("mysql-binlog-ui/" + filePath)
42+
dir = strings.ReplaceAll(dir, "//", "/")
43+
savePath := path.Dir(dir)
44+
if savePath == "." {
45+
dir = strings.ReplaceAll(dir, "\\", "/")
46+
}
47+
return dir
4248
}
4349

4450
// GetSqlitePath 根据系统类型, 返回对应保存数据的目录

0 commit comments

Comments
 (0)