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

Unified Diff: utils/pub/io.dart

Issue 10171019: Add pub (and by extension YAML) to the SDK. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Use Copy(). Created 8 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 | « tools/create_sdk.py ('k') | utils/pub/sdk/pub » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/pub/io.dart
diff --git a/utils/pub/io.dart b/utils/pub/io.dart
index e6e34d06e893cdc6aa5c5082dc7473bba3642320..b1316205f1cf96a6f763d34647a3a0fe864fa9a1 100644
--- a/utils/pub/io.dart
+++ b/utils/pub/io.dart
@@ -9,8 +9,6 @@
#import('dart:io');
-#import('../lib/file_system.dart', prefix: 'fs');
-
/** Gets the current working directory. */
String get workingDir() => new File('.').fullPathSync();
@@ -45,8 +43,17 @@ String join(part1, [part2, part3, part4]) {
* Gets the basename, the file name without any leading directory path, for
* [file], which can either be a [String], [File], or [Directory].
*/
+// TODO(rnystrom): Copied from file_system (so that we don't have to add
+// file_system to the SDK). Should unify.
String basename(file) {
- return fs.basename(_getPath(file));
+ file = _getPath(file).replaceAll('\\', '/');
+
+ int lastSlash = file.lastIndexOf('/', file.length);
+ if (lastSlash == -1) {
+ return file;
+ } else {
+ return file.substring(lastSlash + 1);
+ }
}
/**
« no previous file with comments | « tools/create_sdk.py ('k') | utils/pub/sdk/pub » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698