MCPcopy Create free account
hub / github.com/52funny/pikpakcli / openCacheRoot

Function openCacheRoot

internal/shell/open.go:104–123  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

102}
103
104func openCacheRoot() (string, error) {
105 if strings.TrimSpace(conf.Config.Open.DownloadDir) != "" {
106 root := utils.ExpandLocalPath(conf.Config.Open.DownloadDir)
107 if err := utils.CreateDirIfNotExist(root); err != nil {
108 return "", err
109 }
110 return root, nil
111 }
112
113 cacheDir, err := os.UserCacheDir()
114 if err != nil {
115 cacheDir = filepath.Join(os.TempDir(), "pikpakcli")
116 }
117
118 root := filepath.Join(cacheDir, "pikpakcli", "open")
119 if err := utils.CreateDirIfNotExist(root); err != nil {
120 return "", err
121 }
122 return root, nil
123}
124
125func localFileMatchesRemoteSize(path string, remoteSize string) (bool, error) {
126 expectedSize, err := strconv.ParseInt(remoteSize, 10, 64)

Callers 1

cacheOpenFileFunction · 0.85

Calls 2

ExpandLocalPathFunction · 0.92
CreateDirIfNotExistFunction · 0.92

Tested by

no test coverage detected