From 26a35f113725976515393ed39f0bd963e948aa9c Mon Sep 17 00:00:00 2001 From: Christian Heinrich Date: Sun, 21 Oct 2012 22:05:45 -0500 Subject: [PATCH 1/2] Changed behaviour on init: Open last file. jMemorize will now open the last file on startup; if the file was moved or deleted, there will be no error message and jMemorize will simply startup silently. --- src/jmemorize/core/Main.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/jmemorize/core/Main.java b/src/jmemorize/core/Main.java index 2c6f185..9e09811 100644 --- a/src/jmemorize/core/Main.java +++ b/src/jmemorize/core/Main.java @@ -545,9 +545,19 @@ private void fireLessonModified(Lesson lesson) /** * @param args the command line arguments */ - public static void main(String args[]) + public static void main(String args[]) { - File file = args.length >= 1 ? new File(args[0]) : null; - Main.getInstance().run(file); + File file = null; + if (args.length >= 1) { + file = new File(args[0]); + } + else if (Main.getInstance().getRecentLessonFiles().size() >= 1) { + String filename = Main.getInstance().getRecentLessonFiles().get(0); + file = new File(filename); + if (!file.exists()) { + file = null; + } + } + Main.getInstance().run(file); } } From 25ee3a8ebe7a8db0471df058952db284d539a1dd Mon Sep 17 00:00:00 2001 From: Christian Heinrich Date: Sun, 21 Oct 2012 22:22:25 -0500 Subject: [PATCH 2/2] Fixed checkstyle errors - brackets on newline --- src/jmemorize/core/Main.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/jmemorize/core/Main.java b/src/jmemorize/core/Main.java index 9e09811..48ab5da 100644 --- a/src/jmemorize/core/Main.java +++ b/src/jmemorize/core/Main.java @@ -548,13 +548,16 @@ private void fireLessonModified(Lesson lesson) public static void main(String args[]) { File file = null; - if (args.length >= 1) { + if (args.length >= 1) + { file = new File(args[0]); } - else if (Main.getInstance().getRecentLessonFiles().size() >= 1) { + else if (Main.getInstance().getRecentLessonFiles().size() >= 1) + { String filename = Main.getInstance().getRecentLessonFiles().get(0); file = new File(filename); - if (!file.exists()) { + if (!file.exists()) + { file = null; } }