(final File sketch)
| 1043 | |
| 1044 | |
| 1045 | private static ModeInfo modeInfoFor(final File sketch) { |
| 1046 | final File sketchFolder = sketch.getParentFile(); |
| 1047 | final File sketchProps = new File(sketchFolder, "sketch.properties"); |
| 1048 | if (!sketchProps.exists()) { |
| 1049 | return null; |
| 1050 | } |
| 1051 | try { |
| 1052 | final Settings settings = new Settings(sketchProps); |
| 1053 | final String title = settings.get("mode"); |
| 1054 | final String id = settings.get("mode.id"); |
| 1055 | if (title == null || id == null) { |
| 1056 | return null; |
| 1057 | } |
| 1058 | return new ModeInfo(id, title); |
| 1059 | } catch (IOException e) { |
| 1060 | System.err.println("While trying to read " + sketchProps + ": " |
| 1061 | + e.getMessage()); |
| 1062 | } |
| 1063 | return null; |
| 1064 | } |
| 1065 | |
| 1066 | |
| 1067 | private Mode promptForMode(final File sketch, final ModeInfo preferredMode) { |
no test coverage detected