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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/source_file_provider.dart

Issue 26968003: Remove DirectoryException and LinkException from dart:io and use FileException instaed. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Merge with master. Created 7 years, 1 month 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 | « runtime/bin/stdio_patch.dart ('k') | sdk/lib/_internal/dartdoc/lib/dartdoc.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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 library source_file_provider; 5 library source_file_provider;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:convert'; 8 import 'dart:convert';
9 import 'dart:io'; 9 import 'dart:io';
10 10
(...skipping 25 matching lines...) Expand all
36 return readUtf8BytesFromUri(resourceUri).then(UTF8.decode); 36 return readUtf8BytesFromUri(resourceUri).then(UTF8.decode);
37 } 37 }
38 38
39 Future<List<int>> readUtf8BytesFromUri(Uri resourceUri) { 39 Future<List<int>> readUtf8BytesFromUri(Uri resourceUri) {
40 if (resourceUri.scheme != 'file') { 40 if (resourceUri.scheme != 'file') {
41 throw new ArgumentError("Unknown scheme in uri '$resourceUri'"); 41 throw new ArgumentError("Unknown scheme in uri '$resourceUri'");
42 } 42 }
43 List<int> source; 43 List<int> source;
44 try { 44 try {
45 source = readAll(uriPathToNative(resourceUri.path)); 45 source = readAll(uriPathToNative(resourceUri.path));
46 } on FileException catch (ex) { 46 } on FileSystemException catch (ex) {
47 return new Future.error( 47 return new Future.error(
48 "Error reading '${relativize(cwd, resourceUri, isWindows)}' " 48 "Error reading '${relativize(cwd, resourceUri, isWindows)}' "
49 "(${ex.osError})"); 49 "(${ex.osError})");
50 } 50 }
51 dartCharactersRead += source.length; 51 dartCharactersRead += source.length;
52 sourceFiles[resourceUri.toString()] = new Utf8BytesSourceFile( 52 sourceFiles[resourceUri.toString()] = new Utf8BytesSourceFile(
53 relativize(cwd, resourceUri, isWindows), source); 53 relativize(cwd, resourceUri, isWindows), source);
54 return new Future.value(source); 54 return new Future.value(source);
55 } 55 }
56 56
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 if (fatal && throwOnError) { 142 if (fatal && throwOnError) {
143 isAborting = true; 143 isAborting = true;
144 throw new AbortLeg(message); 144 throw new AbortLeg(message);
145 } 145 }
146 } 146 }
147 147
148 void call(Uri uri, int begin, int end, String message, api.Diagnostic kind) { 148 void call(Uri uri, int begin, int end, String message, api.Diagnostic kind) {
149 return diagnosticHandler(uri, begin, end, message, kind); 149 return diagnosticHandler(uri, begin, end, message, kind);
150 } 150 }
151 } 151 }
OLDNEW
« no previous file with comments | « runtime/bin/stdio_patch.dart ('k') | sdk/lib/_internal/dartdoc/lib/dartdoc.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698