Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for old dart path #366

Merged
merged 1 commit into from
Nov 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

- Clean dart command output stdout [#361](https://github.com/leoafarias/fvm/issues/361)
- Better experience when running `dart pub cache repair` [#352](https://github.com/leoafarias/fvm/issues/352)
- Dart proxy points to correct path when version is older than 1.20.0 [#348](https://github.com/leoafarias/fvm/issues/348)

## 2.2.4

Expand Down
23 changes: 20 additions & 3 deletions lib/src/models/cache_version_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,20 @@ class CacheVersion {

/// Get version bin path
String get binPath {
return join(dir.path, 'bin');
/// Get old bin path
/// Before version 1.17.5 dart path was bin/cache/dart-sdk/bin

if (hasOldBinPath) {
return join(dir.path, 'bin', 'cache', 'dart-sdk', 'bin');
} else {
return join(dir.path, 'bin');
}
}

/// Has old dart path structure
bool get hasOldBinPath {
// Last version with the old dart path structure
return compareSemver(versionWeight, '1.17.5') <= 0;
}

/// Returns dart exec file for cache version
Expand All @@ -41,9 +54,13 @@ class CacheVersion {

/// Compares CacheVersion with [other]
int compareTo(CacheVersion other) {
final version = assignVersionWeight(name);
final otherVersion = assignVersionWeight(other.name);
return compareSemver(version, otherVersion);
return compareSemver(versionWeight, otherVersion);
}

/// Returns true if CacheVersion is compatible with [other]
String get versionWeight {
return assignVersionWeight(name);
}

String toString() {
Expand Down