binstubSdkCheckInputFromPlatform function
Builds a BinstubSdkCheckInput from the real process environment.
Implementation
BinstubSdkCheckInput binstubSdkCheckInputFromPlatform() {
final env = Platform.environment;
var pubCache = env['PUB_CACHE'];
if (pubCache == null || pubCache.isEmpty) {
final home = env['HOME'];
pubCache = (home == null || home.isEmpty) ? null : '$home/.pub-cache';
}
var scriptPath = '';
try {
scriptPath = Platform.script.toFilePath();
} catch (_) {
// Non-file script URI (e.g. data:) — cannot be a global activation.
}
return (
pubCacheDir: pubCache,
runningDartVersion: Platform.version.split(' ').first,
scriptPath: scriptPath,
isWindows: Platform.isWindows,
);
}