summaryrefslogtreecommitdiff
path: root/dice-lang/src/bjc/dicelang/util/ResourceLoader.java
diff options
context:
space:
mode:
authorEVE <EVE@EVE-PC>2017-03-14 12:08:11 -0400
committerEVE <EVE@EVE-PC>2017-03-14 12:08:11 -0400
commit635d3150e3e85c01b777ff165e21fa8965d58440 (patch)
tree3389128f83a5a79f8d0eec0a0e19f54b9d117b66 /dice-lang/src/bjc/dicelang/util/ResourceLoader.java
parente59e2a97773f93bdd25bd4680809c10699f0feb3 (diff)
Cleanup
Diffstat (limited to 'dice-lang/src/bjc/dicelang/util/ResourceLoader.java')
-rw-r--r--dice-lang/src/bjc/dicelang/util/ResourceLoader.java28
1 files changed, 15 insertions, 13 deletions
diff --git a/dice-lang/src/bjc/dicelang/util/ResourceLoader.java b/dice-lang/src/bjc/dicelang/util/ResourceLoader.java
index 1cb29b0..65dc1e4 100644
--- a/dice-lang/src/bjc/dicelang/util/ResourceLoader.java
+++ b/dice-lang/src/bjc/dicelang/util/ResourceLoader.java
@@ -1,40 +1,42 @@
package bjc.dicelang.util;
+import bjc.dicelang.Errors;
+
import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Paths;
-import bjc.dicelang.Errors;
-
-import static bjc.dicelang.Errors.ErrorKey.*;
+import static bjc.dicelang.Errors.ErrorKey.EK_MISC_IOEX;
/**
* Load resources bundled with DiceLang
- *
+ *
* @author EVE
*
*/
public class ResourceLoader {
/**
* Loads a .help file from the data/help directory.
- *
- * @param name The name of the help file to load.
- *
- * @return The contents of the help file, or null if it could not be opened
+ *
+ * @param name
+ * The name of the help file to load.
+ *
+ * @return The contents of the help file, or null if it could not be
+ * opened
*/
public String[] loadHelpFile(String name) {
URL fle = this.getClass().getResource("/data/help/" + name + ".help");
-
+
try {
return Files.lines(Paths.get(fle.toURI())).toArray(sze -> new String[sze]);
- } catch (IOException ioex) {
+ } catch(IOException ioex) {
+ Errors.inst.printError(EK_MISC_IOEX, fle.toString());
+ } catch(URISyntaxException usex) {
Errors.inst.printError(EK_MISC_IOEX, fle.toString());
- } catch (URISyntaxException usex) {
- Errors.inst.printError(EK_MISC_IOEX, fle.toString());
}
-
+
return null;
}
}