| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 library mojo_builtin; | 5 library mojo_builtin; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:convert'; | 8 import 'dart:convert'; |
| 9 import 'dart:mojo.internal'; | 9 import 'dart:mojo.internal'; |
| 10 | 10 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 void _setWorkingDirectory(cwd) { | 56 void _setWorkingDirectory(cwd) { |
| 57 cwd = _enforceTrailingSlash(cwd); | 57 cwd = _enforceTrailingSlash(cwd); |
| 58 _workingDirectoryUri = new Uri(scheme: 'file', path: cwd); | 58 _workingDirectoryUri = new Uri(scheme: 'file', path: cwd); |
| 59 if (_logBuiltin) { | 59 if (_logBuiltin) { |
| 60 _print('# Working Directory: $cwd'); | 60 _print('# Working Directory: $cwd'); |
| 61 } | 61 } |
| 62 } | 62 } |
| 63 | 63 |
| 64 _setPackageRoot(String packageRoot) { | 64 _setPackageRoot(String packageRoot) { |
| 65 packageRoot = _enforceTrailingSlash(packageRoot); | 65 packageRoot = _enforceTrailingSlash(packageRoot); |
| 66 |
| 66 if (packageRoot.startsWith('file:') || | 67 if (packageRoot.startsWith('file:') || |
| 67 packageRoot.startsWith('http:') || | 68 packageRoot.startsWith('http:') || |
| 68 packageRoot.startsWith('https:')) { | 69 packageRoot.startsWith('https:')) { |
| 69 _packageRoot = _workingDirectoryUri.resolve(packageRoot); | 70 _packageRoot = _workingDirectoryUri.resolve(packageRoot); |
| 70 } else { | 71 } else { |
| 71 _packageRoot = _workingDirectoryUri.resolveUri(new Uri.file(packageRoot)); | 72 _packageRoot = _workingDirectoryUri.resolveUri(new Uri.file(packageRoot)); |
| 72 } | 73 } |
| 73 if (_logBuiltin) { | 74 if (_logBuiltin) { |
| 74 _print('# Package root: $packageRoot -> $_packageRoot'); | 75 _print('# Package root: $packageRoot -> $_packageRoot'); |
| 75 } | 76 } |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 // _loadScript(tag, uri, libraryUri, data); | 225 // _loadScript(tag, uri, libraryUri, data); |
| 225 // }); | 226 // }); |
| 226 throw 'Cannot load http, yet.'; | 227 throw 'Cannot load http, yet.'; |
| 227 } else { | 228 } else { |
| 228 // Mojo does not expose any asynchronous file IO calls, but we'll maintain | 229 // Mojo does not expose any asynchronous file IO calls, but we'll maintain |
| 229 // the same structure as the standalone embedder here in case it ever does. | 230 // the same structure as the standalone embedder here in case it ever does. |
| 230 var data = readSync(resourceUri.toFilePath()); | 231 var data = readSync(resourceUri.toFilePath()); |
| 231 _loadScript(tag, uri, libraryUri, data); | 232 _loadScript(tag, uri, libraryUri, data); |
| 232 } | 233 } |
| 233 } | 234 } |
| OLD | NEW |