Skip to content
This repository has been archived by the owner on Feb 6, 2022. It is now read-only.

Commit

Permalink
* Fixed a show-stopper, the ZIP filesystem for the JAR file wasn't be…
Browse files Browse the repository at this point in the history
…ing created
  • Loading branch information
vs49688 committed Dec 26, 2016
1 parent 2460940 commit 81b9520
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/main/java/net/vs49688/rafview/cli/Model.java
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ private static boolean validatePairs(List<Path> files) {
}

public static String getVersionString() {
return String.format("0.5-beta~%s", GitInfo.getShortCommitHash());
return String.format("0.5.1-beta~%s", GitInfo.getShortCommitHash());
}

public static String getApplicationName() {
Expand Down
35 changes: 28 additions & 7 deletions src/main/java/net/vs49688/rafview/gui/Controller.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
import java.nio.file.Paths;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.net.URI;
import java.nio.file.FileSystem;
import java.nio.file.FileSystemNotFoundException;
import java.nio.file.FileSystems;
import javax.swing.SwingUtilities;
import net.vs49688.rafview.vfs.*;
import net.vs49688.rafview.cli.*;
Expand All @@ -41,7 +45,6 @@
import net.vs49688.rafview.sources.CachedSource;
import net.vs49688.rafview.sources.DataSource;
import net.vs49688.rafview.wwise.Wwise;
import org.apache.catalina.LifecycleException;
import org.ini4j.Ini;
import org.ini4j.Profile.Section;

Expand Down Expand Up @@ -103,27 +106,45 @@ public Controller() throws IOException {

m_View.invokeLater();

/* Start the CLI now, if any of the below fails, the application
* will still work. */
SwingUtilities.invokeLater(() -> {
m_CLI.start();
});

/* Load the internal inibin mappings. */
PrintStream s = m_Console.getStream();
try {

s.printf("Loading internal inibin mappings...");

URL url = this.getClass().getResource("/inibin-mappings.ini");

if(url != null) {
m_InibinMapLoader.delayLoad(Paths.get(url.toURI()));
URI uri = url.toURI();
/* Create the JAR filesystem, if it hasn't been already. */
initFileSystem(uri);
m_InibinMapLoader.delayLoad(Paths.get(uri));
s.printf("\n");
} else {
s.printf("Failed. File not found.\n");
}

} catch(URISyntaxException e) {
} catch(URISyntaxException|IOException e) {
s.printf("Failed. Caught exception:\n");
e.printStackTrace(s);
}

SwingUtilities.invokeLater(() -> {
m_CLI.start();
});

}

private static FileSystem initFileSystem(URI uri) throws IOException {
try {
return FileSystems.getFileSystem(uri);
} catch(FileSystemNotFoundException e) {
Map<String, String> env = new HashMap<>();
env.put("create", "true");
return FileSystems.newFileSystem(uri, env);
}
}

private class MenuListener implements ActionListener {
Expand Down

0 comments on commit 81b9520

Please sign in to comment.