()
| 268 | } |
| 269 | |
| 270 | func removeCurrentVersionFile() error { |
| 271 | // currentVersionFilePath is the path to the file that contains the cached |
| 272 | // version. The launcher checks this file to see if a new version is available. |
| 273 | // If the version is newer, then the launcher updates. |
| 274 | // |
| 275 | // Note: keep this in sync with launch.sh code |
| 276 | currentVersionFilePath := filepath.Join(xdg.CacheSubpath("devbox"), "current-version") |
| 277 | |
| 278 | if err := os.Remove(currentVersionFilePath); err != nil && !errors.Is(err, fs.ErrNotExist) { |
| 279 | return usererr.WithLoggedUserMessage( |
| 280 | err, |
| 281 | "Failed to delete version-cache at %s. Please manually delete it and try again.", |
| 282 | currentVersionFilePath, |
| 283 | ) |
| 284 | } |
| 285 | return nil |
| 286 | } |
| 287 | |
| 288 | func SemverCompare(ver1, ver2 string) int { |
| 289 | if !strings.HasPrefix(ver1, "v") { |
no test coverage detected