Index: compiler/java/com/google/dart/compiler/SystemLibrary.java |
diff --git a/compiler/java/com/google/dart/compiler/SystemLibrary.java b/compiler/java/com/google/dart/compiler/SystemLibrary.java |
index ad37ceaca95b3429391784cacb0197c851858d9a..74c0625d2ed3cd0a110d82226502906f98fde9c6 100644 |
--- a/compiler/java/com/google/dart/compiler/SystemLibrary.java |
+++ b/compiler/java/com/google/dart/compiler/SystemLibrary.java |
@@ -6,35 +6,33 @@ package com.google.dart.compiler; |
import java.io.File; |
import java.net.URI; |
-import java.net.URISyntaxException; |
/** |
- * A library accessible via the "dart:<libname>.lib" protocol. |
+ * A library accessible via the "dart:<libname>" protocol. |
*/ |
public class SystemLibrary { |
private final String shortName; |
private final String host; |
private final String pathToLib; |
- private final File dirOrZip; |
+ private final File dir; |
/** |
* Define a new system library such that dart:[shortLibName] will automatically be expanded to |
* dart://[host]/[pathToLib]. For example this call |
* |
* <pre> |
- * new SystemLibrary("dom.lib", "dom", "dart_dom.lib"); |
+ * new SystemLibrary("dom", "dom", "dom.dart"); |
* </pre> |
* |
- * will define a new system library such that "dart:dom.lib" to automatically be expanded to |
- * "dart://dom/dart_dom.lib". The dirOrZip argument is either the root directory or a zip file |
- * containing all files for this library. |
+ * will define a new system library such that "dart:dom" to automatically be expanded to |
+ * "dart://dom/dom.dart". |
*/ |
- public SystemLibrary(String shortName, String host, String pathToLib, File dirOrZip) { |
+ public SystemLibrary(String shortName, String host, String pathToLib) { |
this.shortName = shortName; |
this.host = host; |
this.pathToLib = pathToLib; |
- this.dirOrZip = dirOrZip; |
+ this.dir = new File(this.pathToLib).getParentFile(); |
} |
public String getHost() { |
@@ -50,22 +48,12 @@ public class SystemLibrary { |
} |
public URI translateUri(URI dartUri) { |
- if (!dirOrZip.exists()) { |
- throw new RuntimeException("System library for " + dartUri + " does not exist: " + dirOrZip.getPath()); |
- } |
- try { |
- URI dirOrZipURI = dirOrZip.toURI(); |
- if (dirOrZip.isFile()) { |
- return new URI("jar", "file:" + dirOrZipURI.getPath() + "!" + dartUri.getPath(), null); |
- } else { |
- return dirOrZipURI.resolve("." + dartUri.getPath()); |
- } |
- } catch (URISyntaxException e) { |
- throw new AssertionError(); |
- } |
+ |
+ URI dirURI = dir.toURI(); |
+ return dirURI.resolve("." + dartUri.getPath()); |
} |
- |
+ |
public File getFile() { |
- return this.dirOrZip; |
+ return this.dir; |
} |
} |