Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Unified Diff: sdk/lib/_internal/pub_generated/lib/src/global_packages.dart

Issue 599343003: Get binstubs working on Windows. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update comment. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sdk/lib/_internal/pub_generated/lib/src/global_packages.dart
diff --git a/sdk/lib/_internal/pub_generated/lib/src/global_packages.dart b/sdk/lib/_internal/pub_generated/lib/src/global_packages.dart
index 8be1156acc52833f87acd12a4eb584d7bb120d17..52039654d01f9690848c9c6ffc4f18ac88aad73b 100644
--- a/sdk/lib/_internal/pub_generated/lib/src/global_packages.dart
+++ b/sdk/lib/_internal/pub_generated/lib/src/global_packages.dart
@@ -494,6 +494,7 @@ class GlobalPackages {
String _createBinStub(Package package, String executable, String script,
{bool overwrite, String snapshot}) {
var binStubPath = p.join(_binStubDir, executable);
+ if (Platform.operatingSystem == "windows") binStubPath += ".bat";
var previousPackage;
if (fileExists(binStubPath)) {
var contents = readTextFile(binStubPath);
@@ -520,7 +521,7 @@ rem Package: ${package.name}
rem Version: ${package.version}
rem Executable: ${executable}
rem Script: ${script}
-$invocation "%*"
+$invocation %*
""";
writeTextFile(binStubPath, batch);
} else {
@@ -565,16 +566,11 @@ $invocation "\$@"
}
void _suggestIfNotOnPath(List<String> installed) {
if (Platform.operatingSystem == "windows") {
- var result = runProcessSync("where", [r"\q", installed.first]);
+ var result = runProcessSync("where", [r"\q", installed.first + ".bat"]);
if (result.exitCode == 0) return;
- var binDir = _binStubDir;
- if (binDir.startsWith(Platform.environment['APPDATA'])) {
- binDir =
- p.join("%APPDATA%", p.relative(binDir, from: Platform.environment['APPDATA']));
- }
log.warning(
"${log.yellow('Warning:')} Pub installs executables into "
- "${log.bold(binDir)}, which is not on your path.\n"
+ "${log.bold(_binStubDir)}, which is not on your path.\n"
"You can fix that by adding that directory to your system's "
'"Path" environment variable.\n'
'A web search for "configure windows path" will show you how.');

Powered by Google App Engine
This is Rietveld 408576698