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

Unified Diff: sdk/lib/_internal/pub/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/lib/src/global_packages.dart
diff --git a/sdk/lib/_internal/pub/lib/src/global_packages.dart b/sdk/lib/_internal/pub/lib/src/global_packages.dart
index 0f87dc0fa0fb226ddb2d0595d11616e0a166dc2c..c51e545ec449ba13e26331ca1592377146f89b15 100644
--- a/sdk/lib/_internal/pub/lib/src/global_packages.dart
+++ b/sdk/lib/_internal/pub/lib/src/global_packages.dart
@@ -530,6 +530,8 @@ class GlobalPackages {
{bool overwrite, String snapshot}) {
var binStubPath = p.join(_binStubDir, executable);
+ if (Platform.operatingSystem == "windows") binStubPath += ".bat";
+
// See if the binstub already exists. If so, it's for another package
// since we already deleted all of this package's binstubs.
var previousPackage;
@@ -557,7 +559,6 @@ class GlobalPackages {
}
if (Platform.operatingSystem == "windows") {
-
var batch = """
@echo off
rem This file was created by pub v${sdk.version}.
@@ -565,7 +566,7 @@ rem Package: ${package.name}
rem Version: ${package.version}
rem Executable: ${executable}
rem Script: ${script}
-$invocation "%*"
+$invocation %*
""";
writeTextFile(binStubPath, batch);
} else {
@@ -624,18 +625,12 @@ $invocation "\$@"
if (Platform.operatingSystem == "windows") {
// See if the shell can find one of the binstubs.
// "\q" means return exit code 0 if found or 1 if not.
- 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']));
- }
nweiz 2014/09/25 19:41:14 Why not include "%APPDATA%"?
Bob Nystrom 2014/09/25 19:48:16 On POSIX, you'll be adding to your path in a shell
-
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