feat: windows app update

This commit is contained in:
Simon Ding
2025-04-29 18:54:56 +08:00
parent 3a73d0c33e
commit 5375f66018
14 changed files with 63 additions and 25 deletions

21
pkg/utils/dir_lib.go Normal file
View File

@@ -0,0 +1,21 @@
//go:build lib
package utils
import (
"os"
"path/filepath"
)
func GetUserDataDir() string {
d, err := os.UserHomeDir()
if err != nil {
panic(err)
}
d = filepath.Join(d, ".polaris")
if _, err := os.Stat(d); os.IsNotExist(err) {
os.MkdirAll(d, os.ModePerm)
}
return d
}

7
pkg/utils/dir_other.go Normal file
View File

@@ -0,0 +1,7 @@
//go:build !lib
package utils
func GetUserDataDir() string {
return "./data"
}

View File

@@ -247,7 +247,7 @@ func GetRealLinkAndHash(link string) (string, string, error) {
if err != nil {
return "", "", errors.Wrap(err, "parse response")
}
return link,info.HashInfoBytes().HexString(), nil
return link, info.HashInfoBytes().HexString(), nil
}
func Link2Magnet(link string) (string, error) {