()
| 102 | } |
| 103 | |
| 104 | func 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 | |
| 125 | func localFileMatchesRemoteSize(path string, remoteSize string) (bool, error) { |
| 126 | expectedSize, err := strconv.ParseInt(remoteSize, 10, 64) |
no test coverage detected