Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix jar execution (but it is very ugly now)

  • Loading branch information...
commit 0fda398898b57797a986db36ddaccbb5ef3084dc 1 parent f65ddb6
@d0k authored
Showing with 14 additions and 2 deletions.
  1. +14 −2 FileList.java
View
16 FileList.java
@@ -14,9 +14,21 @@
private FileList() {
try {
ByteArrayOutputStream out = new ByteArrayOutputStream();
- RandomAccessFile in = new RandomAccessFile("files.lzma", "r");
- MappedByteBuffer buf = in.getChannel().map(FileChannel.MapMode.READ_ONLY, 0, in.length());
+ //TODO: less ugliness here
+ File tmp = File.createTempFile("files", ".lzma");
+ {
+ InputStream tmpin = this.getClass().getClassLoader().getResourceAsStream("files.lzma");
+ FileOutputStream tmpout = new FileOutputStream(tmp);
+ byte[] buf = new byte[1024];
+ int i = 0;
+ while ((i = tmpin.read(buf)) != -1) {
+ tmpout.write(buf, 0, i);
+ }
+ }
+ FileInputStream in = new FileInputStream(tmp);
+ MappedByteBuffer buf = in.getChannel().map(FileChannel.MapMode.READ_ONLY, 0, in.getChannel().size());
in.close();
+ tmp.delete();
Decoder decoder = new Decoder();
decoder.SetDecoderProperties(Unpack.readProps(buf));
Please sign in to comment.
Something went wrong with that request. Please try again.