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

Side by Side Diff: sdk/lib/io/directory_impl.dart

Issue 1083393004: Add uri getter on file system entity. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sdk/lib/io/directory.dart ('k') | sdk/lib/io/file.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 part of dart.io; 5 part of dart.io;
6 6
7 class _Directory extends FileSystemEntity implements Directory { 7 class _Directory extends FileSystemEntity implements Directory {
8 final String path; 8 final String path;
9 9
10 _Directory(this.path) { 10 _Directory(this.path) {
(...skipping 25 matching lines...) Expand all
36 static void set current(path) { 36 static void set current(path) {
37 if (path is Directory) path = path.path; 37 if (path is Directory) path = path.path;
38 var result = _setCurrent(path); 38 var result = _setCurrent(path);
39 if (result is ArgumentError) throw result; 39 if (result is ArgumentError) throw result;
40 if (result is OSError) { 40 if (result is OSError) {
41 throw new FileSystemException( 41 throw new FileSystemException(
42 "Setting current working directory failed", path, result); 42 "Setting current working directory failed", path, result);
43 } 43 }
44 } 44 }
45 45
46 Uri get uri {
47 String path = this.path;
48 if (!path.endsWith("/")) {
49 path = path + "/";
50 }
51 return new Uri.file(path);
52 }
53
46 Future<bool> exists() { 54 Future<bool> exists() {
47 return _IOService._dispatch(_DIRECTORY_EXISTS, [path]).then((response) { 55 return _IOService._dispatch(_DIRECTORY_EXISTS, [path]).then((response) {
48 if (_isErrorResponse(response)) { 56 if (_isErrorResponse(response)) {
49 throw _exceptionOrErrorFromResponse(response, "Exists failed"); 57 throw _exceptionOrErrorFromResponse(response, "Exists failed");
50 } 58 }
51 return response == 1; 59 return response == 1;
52 }); 60 });
53 } 61 }
54 62
55 bool existsSync() { 63 bool existsSync() {
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 controller.addError( 388 controller.addError(
381 new FileSystemException("Directory listing failed", 389 new FileSystemException("Directory listing failed",
382 errorPath, 390 errorPath,
383 err)); 391 err));
384 } else { 392 } else {
385 controller.addError( 393 controller.addError(
386 new FileSystemException("Internal error")); 394 new FileSystemException("Internal error"));
387 } 395 }
388 } 396 }
389 } 397 }
OLDNEW
« no previous file with comments | « sdk/lib/io/directory.dart ('k') | sdk/lib/io/file.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698