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

Unified Diff: sdk/lib/_internal/pub/lib/src/io.dart

Issue 14449004: Clean up various ways we find paths in pub. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes. Created 7 years, 8 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
« no previous file with comments | « sdk/lib/_internal/dartdoc/lib/src/dartdoc/utils.dart ('k') | sdk/lib/_internal/pub/lib/src/sdk.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/pub/lib/src/io.dart
diff --git a/sdk/lib/_internal/pub/lib/src/io.dart b/sdk/lib/_internal/pub/lib/src/io.dart
index f70b18a32f321a693132ba7944447263e40db29e..fef43ec81cd3b33ceb3c35a2752094a5392c0a78 100644
--- a/sdk/lib/_internal/pub/lib/src/io.dart
+++ b/sdk/lib/_internal/pub/lib/src/io.dart
@@ -3,7 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
/// Helper functionality to make working with IO easier.
-library io;
+library pub.io;
import 'dart:async';
import 'dart:io';
@@ -253,22 +253,8 @@ void createPackageSymlink(String name, String target, String symlink,
}
/// Resolves [target] relative to the root directory of pub.
-String relativeToPub(String target) {
- var scriptPath = new File(new Options().script).fullPathSync();
-
- // Walk up until we hit the "internal(s)" directory. This lets us figure out
- // where we are if this function is called from pub.dart, one of the tests, or
- // from the SDK.
- var internalDir = path.dirname(scriptPath);
- while (path.basename(internalDir) != '_internal') {
- if (path.basename(internalDir) == '') {
- throw new Exception('Could not find path to pub.');
- }
- internalDir = path.dirname(internalDir);
- }
-
- return path.normalize(path.join(internalDir, 'pub', target));
-}
+String relativeToPub(String target) => path.normalize(path.join(
+ path.dirname(libraryPath('pub.io')), '..', '..', target));
/// A line-by-line stream of standard input.
final Stream<String> stdinLines = streamToLines(
« no previous file with comments | « sdk/lib/_internal/dartdoc/lib/src/dartdoc/utils.dart ('k') | sdk/lib/_internal/pub/lib/src/sdk.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698