1
0
mirror of https://github.com/zu1k/nali.git synced 2025-02-02 10:22:41 +08:00

fix: migration find old dir path

Signed-off-by: zu1k <i@zu1k.com>
This commit is contained in:
zu1k 2022-10-06 13:05:35 +08:00
parent 462503377c
commit 5039161a5c
No known key found for this signature in database
GPG Key ID: AE381A8FB1EF2CC8

View File

@ -8,10 +8,13 @@ import (
"github.com/zu1k/nali/internal/constant"
)
const oldDefaultWorkPath = "~/.nali/"
func migration2v6() {
_, err := os.Stat(oldDefaultWorkPath)
homeDir, err := os.UserHomeDir()
if err != nil {
return
}
oldDefaultWorkPath := filepath.Join(homeDir, ".nali")
_, err = os.Stat(oldDefaultWorkPath)
if err == nil {
println("Old data directories are detected and will attempt to migrate automatically")
oldDefaultConfigPath := filepath.Join(oldDefaultWorkPath, "config.yaml")