Skip to content

Commit

Permalink
Enable encoding classpath imports
Browse files Browse the repository at this point in the history
  • Loading branch information
TimWSpence authored and travisbrown committed Apr 16, 2020
1 parent 4a7b96f commit 443c590
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions modules/core/src/main/java/org/dhallj/core/binary/Encode.java
Original file line number Diff line number Diff line change
Expand Up @@ -466,23 +466,22 @@ public Void onLocalImport(final Path path, final Expr.ImportMode mode, final byt

@Override
public Void onClasspathImport(Path path, Expr.ImportMode mode, byte[] hash) {
throw new RuntimeException("BOOM");
// int size = 4 + path.getNameCount();
// this.writer.writeArrayStart(size);
// this.writer.writeLong(Label.IMPORT);
// if (hash == null) {
// this.writer.writeNull();
// } else {
// this.writer.writeByteString(multihash(hash));
// }
// this.writer.writeLong(modeLabel(mode));
// this.writer.writeLong(Label.IMPORT_TYPE_CLASSPATH);
//
// Iterator<Path> parts = path.iterator();
// while (parts.hasNext()) {
// this.writer.writeString(parts.next().toString());
// }
// return null;
int size = 4 + path.getNameCount();
this.writer.writeArrayStart(size);
this.writer.writeLong(Label.IMPORT);
if (hash == null) {
this.writer.writeNull();
} else {
this.writer.writeByteString(multihash(hash));
}
this.writer.writeLong(modeLabel(mode));
this.writer.writeLong(Label.IMPORT_TYPE_CLASSPATH);

Iterator<Path> parts = path.iterator();
while (parts.hasNext()) {
this.writer.writeString(parts.next().toString());
}
return null;
}

private static final int urlLabel(URI url) {
Expand Down

0 comments on commit 443c590

Please sign in to comment.