stripDartVersionSuffix static method
internal method do not use.
Implementation
@visibleForTesting
static String stripDartVersionSuffix(String pathToCurrentScript) {
var result = pathToCurrentScript;
/// Not certain what is going on here.
/// If we use a pub global activated version then
/// Platform.script is returning a filename of the form:
/// pub_release.dart-2.13.0.snapshot
/// So we look to strip of the suffix from the - onward.
if (pathToCurrentScript.contains('.dart-')) {
var index = pathToCurrentScript.indexOf('.dart-');
index += 5;
result = pathToCurrentScript.substring(0, index);
}
return result;
}