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

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: Rebase. 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
Index: utils/pub/io.dart
diff --git a/utils/pub/io.dart b/utils/pub/io.dart
index 5c505c287c8a81524d8d56279be089524cdd15f7..e7da4d692d846e6fbe5fea4d464fdeaaa7e5a009 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);
+ }
}
/**

Powered by Google App Engine
This is Rietveld 408576698