platform/lib/src/commands/pub.dart

13 lines
332 B
Dart
Raw Normal View History

2017-06-16 02:57:35 +00:00
import 'dart:io';
final RegExp _leadingSlashes = new RegExp(r'^/+');
String resolvePub() {
var exec = new File(Platform.resolvedExecutable);
var pubPath = exec.parent.uri.resolve('pub').path;
if (Platform.isWindows)
pubPath = pubPath.replaceAll(_leadingSlashes, '') + '.bat';
pubPath = Uri.decodeFull(pubPath);
return pubPath;
}