platform/lib/src/commands/pub.dart
2017-06-15 22:57:35 -04:00

13 lines
No EOL
332 B
Dart

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;
}