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

Side by Side Diff: utils/pub/io.dart

Issue 11931040: adds file path source to pub (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebase to newest as of 5 min ago Created 7 years, 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | utils/pub/path_source.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /// Helper functionality to make working with IO easier. 5 /// Helper functionality to make working with IO easier.
6 library io; 6 library io;
7 7
8 import 'dart:async'; 8 import 'dart:async';
9 import 'dart:io'; 9 import 'dart:io';
10 import 'dart:isolate'; 10 import 'dart:isolate';
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 } 391 }
392 392
393 /// Creates a new symlink that creates an alias from the `lib` directory of 393 /// Creates a new symlink that creates an alias from the `lib` directory of
394 /// package [from] to [to], both of which can be a [String], [File], or 394 /// package [from] to [to], both of which can be a [String], [File], or
395 /// [Directory]. Returns a [Future] which completes to the symlink file (i.e. 395 /// [Directory]. Returns a [Future] which completes to the symlink file (i.e.
396 /// [to]). If [from] does not have a `lib` directory, this shows a warning if 396 /// [to]). If [from] does not have a `lib` directory, this shows a warning if
397 /// appropriate and then does nothing. 397 /// appropriate and then does nothing.
398 Future<File> createPackageSymlink(String name, from, to, 398 Future<File> createPackageSymlink(String name, from, to,
399 {bool isSelfLink: false}) { 399 {bool isSelfLink: false}) {
400 // See if the package has a "lib" directory. 400 // See if the package has a "lib" directory.
401 from = join(from, 'lib'); 401 // Note(Sam): Relative paths causes issues when cwd is different.
402 // also, absolute paths are safer when app is moved around.
403 from = getFullPath(join(from, 'lib'));
402 return dirExists(from).then((exists) { 404 return dirExists(from).then((exists) {
403 log.fine("Creating ${isSelfLink ? "self" : ""}link for package '$name'."); 405 log.fine("Creating ${isSelfLink ? "self" : ""}link for package '$name'.");
404 if (exists) return createSymlink(from, to); 406 if (exists) return createSymlink(from, to);
405 407
406 // It's OK for the self link (i.e. the root package) to not have a lib 408 // It's OK for the self link (i.e. the root package) to not have a lib
407 // directory since it may just be a leaf application that only has 409 // directory since it may just be a leaf application that only has
408 // code in bin or web. 410 // code in bin or web.
409 if (!isSelfLink) { 411 if (!isSelfLink) {
410 log.warning('Warning: Package "$name" does not have a "lib" directory so ' 412 log.warning('Warning: Package "$name" does not have a "lib" directory so '
411 'you will not be able to import any libraries from it.'); 413 'you will not be able to import any libraries from it.');
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after
1030 Directory _getDirectory(entry) { 1032 Directory _getDirectory(entry) {
1031 if (entry is Directory) return entry; 1033 if (entry is Directory) return entry;
1032 return new Directory(entry); 1034 return new Directory(entry);
1033 } 1035 }
1034 1036
1035 /// Gets a [Uri] for [uri], which can either already be one, or be a [String]. 1037 /// Gets a [Uri] for [uri], which can either already be one, or be a [String].
1036 Uri _getUri(uri) { 1038 Uri _getUri(uri) {
1037 if (uri is Uri) return uri; 1039 if (uri is Uri) return uri;
1038 return new Uri.fromString(uri); 1040 return new Uri.fromString(uri);
1039 } 1041 }
OLDNEW
« no previous file with comments | « no previous file | utils/pub/path_source.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698