OLD | NEW |
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 #library('dart2js'); | 5 #library('dart2js'); |
6 | 6 |
7 #import('dart:io'); | 7 #import('dart:io'); |
8 #import('dart:utf'); | 8 #import('dart:utf'); |
9 | 9 |
10 #import('../../lib/uri/uri.dart'); | 10 #import('../../uri/uri.dart'); |
11 #import('../../frog/leg/api.dart', prefix: 'api'); | 11 #import('../compiler.dart', prefix: 'api'); |
12 #import('../../frog/leg/io/io.dart', prefix: 'io'); | 12 #import('io/io.dart', prefix: 'io'); |
13 #import('../../frog/leg/colors.dart'); | 13 #import('colors.dart'); |
14 #import('source_file.dart'); | 14 #import('source_file.dart'); |
15 | 15 |
16 String relativize(Uri base, Uri uri) { | 16 String relativize(Uri base, Uri uri) { |
17 if (base.scheme == 'file' && | 17 if (base.scheme == 'file' && |
18 base.scheme == uri.scheme && | 18 base.scheme == uri.scheme && |
19 base.userInfo == uri.userInfo && | 19 base.userInfo == uri.userInfo && |
20 base.domain == uri.domain && | 20 base.domain == uri.domain && |
21 base.port == uri.port && | 21 base.port == uri.port && |
22 uri.query == "" && uri.fragment == "") { | 22 uri.query == "" && uri.fragment == "") { |
23 if (uri.path.startsWith(base.path)) { | 23 if (uri.path.startsWith(base.path)) { |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 } | 144 } |
145 | 145 |
146 String readAll(String filename) { | 146 String readAll(String filename) { |
147 var file = (new File(filename)).openSync(); | 147 var file = (new File(filename)).openSync(); |
148 var length = file.lengthSync(); | 148 var length = file.lengthSync(); |
149 var buffer = new List<int>(length); | 149 var buffer = new List<int>(length); |
150 var bytes = file.readListSync(buffer, 0, length); | 150 var bytes = file.readListSync(buffer, 0, length); |
151 file.closeSync(); | 151 file.closeSync(); |
152 return new String.fromCharCodes(new Utf8Decoder(buffer).decodeRest()); | 152 return new String.fromCharCodes(new Utf8Decoder(buffer).decodeRest()); |
153 } | 153 } |
OLD | NEW |