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

Unified Diff: runtime/bin/builtin.dart

Issue 321543003: New, more validating, parser for URI. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: One more test. Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/json_rpc_2/test/server/parameters_test.dart ('k') | sdk/lib/core/uri.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/builtin.dart
diff --git a/runtime/bin/builtin.dart b/runtime/bin/builtin.dart
index 8f6ea77564c2771e59a27500c670b3548c73776c..95789889852011c7af5928f390f92d44773deb9b 100644
--- a/runtime/bin/builtin.dart
+++ b/runtime/bin/builtin.dart
@@ -215,7 +215,12 @@ void _setWorkingDirectory(cwd) {
_workingWindowsDrivePrefix = _extractDriveLetterPrefix(cwd);
cwd = _sanitizeWindowsPath(cwd);
cwd = _enforceTrailingSlash(cwd);
- _workingDirectoryUri = new Uri(scheme: 'file', path: cwd);
+ _workingDirectoryUri = new Uri.file(cwd);
+ if (!_workingDirectoryUri.path.endsWith("/")) {
+ var directoryPath = _workingDirectoryUri.path + "/";
+ _workingDirectoryUri = _workingDirectoryUri.resolve(directoryPath);
+ }
+
_logResolution('# Working Directory: $cwd');
}
@@ -238,8 +243,15 @@ String _resolveScriptUri(String scriptName) {
throw 'No current working directory set.';
}
scriptName = _sanitizeWindowsPath(scriptName);
-
- var scriptUri = Uri.parse(scriptName);
+ var scriptUri;
+ if (scriptName.startsWith("file:") ||
+ scriptName.startsWith("http:") ||
+ scriptName.startsWith("https:")) {
+ scriptUri = Uri.parse(scriptName);
+ } else {
+ // Assume it's a file name.
+ scriptUri = new Uri.file(scriptName);
+ }
if (scriptUri.scheme != '') {
// Script has a scheme, assume that it is fully formed.
_entryPointScript = scriptUri;
« no previous file with comments | « pkg/json_rpc_2/test/server/parameters_test.dart ('k') | sdk/lib/core/uri.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698