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 builtin; | 5 library builtin; |
6 import 'dart:io'; | 6 import 'dart:io'; |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:convert'; | 8 import 'dart:convert'; |
9 // import 'root_library'; happens here from C Code | 9 // import 'root_library'; happens here from C Code |
10 | 10 |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
207 if (cwd.length > 1 && cwd[1] == ':') { | 207 if (cwd.length > 1 && cwd[1] == ':') { |
208 return '/${cwd[0]}:'; | 208 return '/${cwd[0]}:'; |
209 } | 209 } |
210 return null; | 210 return null; |
211 } | 211 } |
212 | 212 |
213 | 213 |
214 void _setWorkingDirectory(cwd) { | 214 void _setWorkingDirectory(cwd) { |
215 _workingWindowsDrivePrefix = _extractDriveLetterPrefix(cwd); | 215 _workingWindowsDrivePrefix = _extractDriveLetterPrefix(cwd); |
216 cwd = _sanitizeWindowsPath(cwd); | 216 cwd = _sanitizeWindowsPath(cwd); |
217 cwd = _enforceTrailingSlash(cwd); | 217 cwd = _enforceTrailingSlash(cwd); |
Lasse Reichstein Nielsen
2014/06/13 11:53:04
Are these sanitizations still necessary when using
Anders Johnsen
2014/06/13 12:41:38
Please try without.
Søren Gjesse
2014/06/13 15:25:04
I think it is - if this is used with .resolve then
| |
218 _workingDirectoryUri = new Uri(scheme: 'file', path: cwd); | 218 _workingDirectoryUri = new Uri.file(cwd); |
219 _logResolution('# Working Directory: $cwd'); | 219 _logResolution('# Working Directory: $cwd'); |
220 } | 220 } |
221 | 221 |
222 | 222 |
223 _setPackageRoot(String packageRoot) { | 223 _setPackageRoot(String packageRoot) { |
224 packageRoot = _enforceTrailingSlash(packageRoot); | 224 packageRoot = _enforceTrailingSlash(packageRoot); |
225 if (packageRoot.startsWith('file:') || | 225 if (packageRoot.startsWith('file:') || |
226 packageRoot.startsWith('http:') || | 226 packageRoot.startsWith('http:') || |
227 packageRoot.startsWith('https:')) { | 227 packageRoot.startsWith('https:')) { |
228 _packageRoot = _workingDirectoryUri.resolve(packageRoot); | 228 _packageRoot = _workingDirectoryUri.resolve(packageRoot); |
229 } else { | 229 } else { |
230 _packageRoot = _workingDirectoryUri.resolveUri(new Uri.file(packageRoot)); | 230 _packageRoot = _workingDirectoryUri.resolveUri(new Uri.file(packageRoot)); |
231 } | 231 } |
232 _logResolution('# Package root: $packageRoot -> $_packageRoot'); | 232 _logResolution('# Package root: $packageRoot -> $_packageRoot'); |
233 } | 233 } |
234 | 234 |
235 | 235 |
236 String _resolveScriptUri(String scriptName) { | 236 String _resolveScriptUri(String scriptName) { |
237 if (_workingDirectoryUri == null) { | 237 if (_workingDirectoryUri == null) { |
238 throw 'No current working directory set.'; | 238 throw 'No current working directory set.'; |
239 } | 239 } |
240 scriptName = _sanitizeWindowsPath(scriptName); | 240 scriptName = _sanitizeWindowsPath(scriptName); |
241 | 241 var scriptUri; |
242 var scriptUri = Uri.parse(scriptName); | 242 if (scriptName.startsWith("file:") || |
243 scriptName.startsWith("http:") || | |
244 scriptName.startsWith("https:")) { | |
245 scriptUri = Uri.parse(scriptName); | |
246 } else { | |
247 // Assume it's a file name. | |
248 scriptUri = new Uri.file(scriptName); | |
249 } | |
243 if (scriptUri.scheme != '') { | 250 if (scriptUri.scheme != '') { |
244 // Script has a scheme, assume that it is fully formed. | 251 // Script has a scheme, assume that it is fully formed. |
245 _entryPointScript = scriptUri; | 252 _entryPointScript = scriptUri; |
246 } else { | 253 } else { |
247 // Script does not have a scheme, assume that it is a path, | 254 // Script does not have a scheme, assume that it is a path, |
248 // resolve it against the working directory. | 255 // resolve it against the working directory. |
249 _entryPointScript = _workingDirectoryUri.resolve(scriptName); | 256 _entryPointScript = _workingDirectoryUri.resolve(scriptName); |
250 } | 257 } |
251 _logResolution('# Resolved entry point to: $_entryPointScript'); | 258 _logResolution('# Resolved entry point to: $_entryPointScript'); |
252 return _entryPointScript.toString(); | 259 return _entryPointScript.toString(); |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
399 } else if (Platform.isWindows) { | 406 } else if (Platform.isWindows) { |
400 filename = '$name.dll'; | 407 filename = '$name.dll'; |
401 } else { | 408 } else { |
402 _logResolution( | 409 _logResolution( |
403 'Native extensions not supported on ${Platform.operatingSystem}'); | 410 'Native extensions not supported on ${Platform.operatingSystem}'); |
404 throw 'Native extensions not supported on ${Platform.operatingSystem}'; | 411 throw 'Native extensions not supported on ${Platform.operatingSystem}'; |
405 } | 412 } |
406 | 413 |
407 return [path, filename, name]; | 414 return [path, filename, name]; |
408 } | 415 } |
OLD | NEW |