diff --git a/diylc/diylc-core/src/org/diylc/lang/LangUtil.java b/diylc/diylc-core/src/org/diylc/lang/LangUtil.java index 034cf6a3..75862775 100644 --- a/diylc/diylc-core/src/org/diylc/lang/LangUtil.java +++ b/diylc/diylc-core/src/org/diylc/lang/LangUtil.java @@ -89,8 +89,10 @@ public class LangUtil { LOG.info("Loading translation for " + language); dict = new HashMap(); try { + String path = ResourceLoader.getFile(LANG_DIR + File.separator + language + ".txt").getAbsolutePath(); + LOG.debug("Loading language file: " + path); try (Stream stream = Files.lines( - Paths.get(LANG_DIR + File.separator + language + ".txt"), StandardCharsets.UTF_8)) { + Paths.get(path), StandardCharsets.UTF_8)) { stream.forEach(s -> { if (s.contains("|")) { String[] parts = s.split("\\|"); diff --git a/diylc/diylc-core/src/org/diylc/presenter/Presenter.java b/diylc/diylc-core/src/org/diylc/presenter/Presenter.java index cb525390..9f9bc944 100644 --- a/diylc/diylc-core/src/org/diylc/presenter/Presenter.java +++ b/diylc/diylc-core/src/org/diylc/presenter/Presenter.java @@ -431,13 +431,17 @@ public class Presenter implements IPlugInPort { Set> componentTypeClasses = null; try { componentTypeClasses = Utils.getClasses("org.diylc.components"); - try { - List> additionalComponentTypeClasses = - JarScanner.getInstance().scanFolder("library", IDIYComponent.class); - if (additionalComponentTypeClasses != null) - componentTypeClasses.addAll(additionalComponentTypeClasses); - } catch (Exception e) { - LOG.warn("Could not find additional type classes", e); + File libraryFile = new File("library"); + if (libraryFile.exists() && libraryFile.isDirectory()) { + LOG.info("Loading additional library JARs"); + try { + List> additionalComponentTypeClasses = + JarScanner.getInstance().scanFolder("library", IDIYComponent.class); + if (additionalComponentTypeClasses != null) + componentTypeClasses.addAll(additionalComponentTypeClasses); + } catch (Exception e) { + LOG.warn("Could not find additional type classes", e); + } } for (Class clazz : componentTypeClasses) { diff --git a/diylc/diylc-core/src/org/diylc/presenter/update.xml b/diylc/diylc-core/src/org/diylc/presenter/update.xml index 7e07aa57..2610feb0 100644 --- a/diylc/diylc-core/src/org/diylc/presenter/update.xml +++ b/diylc/diylc-core/src/org/diylc/presenter/update.xml @@ -3333,6 +3333,10 @@ BUG_FIX Dragging components from the component tree to the canvas stops working once the component type is selected in the tree + + + BUG_FIX + macOS: fixed language selection that does not work https://github.com/bancika/diy-layout-creator/releases diff --git a/diylc/diylc-core/src/org/diylc/utils/ResourceLoader.java b/diylc/diylc-core/src/org/diylc/utils/ResourceLoader.java index 16e72e48..d300f8d8 100644 --- a/diylc/diylc-core/src/org/diylc/utils/ResourceLoader.java +++ b/diylc/diylc-core/src/org/diylc/utils/ResourceLoader.java @@ -30,7 +30,7 @@ public class ResourceLoader { String bundlePath; try { bundlePath = com.apple.eio.FileManager.getPathToApplicationBundle(); - LOG.debug("Detected OSX bundle path: " + bundlePath); + //LOG.debug("Detected OSX bundle path: " + bundlePath); } catch (Exception e) { bundlePath = null; // on non-OSX platforms } @@ -48,4 +48,26 @@ public class ResourceLoader { return null; } } + + public static File getFile(String relativePath) { + String bundlePath; + try { + bundlePath = com.apple.eio.FileManager.getPathToApplicationBundle(); + //LOG.debug("Detected OSX bundle path: " + bundlePath); + } catch (Exception e) { + bundlePath = null; // on non-OSX platforms + } + try { + String absolutePath; + if (bundlePath == null) + absolutePath = relativePath; + else + absolutePath = bundlePath + File.separator + "Contents" + File.separator + "Resources" + File.separator + relativePath; + File absoluteFile = new File(absolutePath); + return absoluteFile; + } catch (Exception e) { + LOG.error("Error while finding file: " + relativePath, e); + return null; + } + } } diff --git a/diylc/diylc-swing/lang/Srpski.txt b/diylc/diylc-swing/lang/Srpski.txt index 0d27d66c..83cd80ee 100644 --- a/diylc/diylc-swing/lang/Srpski.txt +++ b/diylc/diylc-swing/lang/Srpski.txt @@ -131,7 +131,7 @@ Electrode Labels|Oznake Elektroda Electro-Mechanical|Elektro-Mehaničke Enable Cache Boost|Uključi Keš-Ubrzanje End Arrow|Krajnja Strelica -Enjoying DIYLC? Click here to buy me a coffee :)|Uživate koristeći DIYLC? Kupite mi kafu :) +Enjoying DIYLC? Click here to buy me a coffee :)|Uživate koristeći DIYLC? Častite me kafom :) Error|Greška Error occurred while editing selection. Check the log for details.|Nastala je greška prilikom izmene. Proverite log za više informacija. Exit|Izlaz diff --git a/diylc/diylc-swing/src/org/diylc/swing/gui/actionbar/ActionBarPlugin.java b/diylc/diylc-swing/src/org/diylc/swing/gui/actionbar/ActionBarPlugin.java index 4adf4cc7..79fbbe09 100644 --- a/diylc/diylc-swing/src/org/diylc/swing/gui/actionbar/ActionBarPlugin.java +++ b/diylc/diylc-swing/src/org/diylc/swing/gui/actionbar/ActionBarPlugin.java @@ -160,6 +160,8 @@ public class ActionBarPlugin implements IPlugIn { toggleItems.add(new ToggleItem(IPlugInPort.SNAP_TO_COMPONENTS, IPlugInPort.SNAP_TO_COMPONENTS, IconLoader.SnapToComponents.getIcon())); configToolbar.addToggleLabel(LangUtil.translate("Snap To"), IPlugInPort.SNAP_TO_KEY, IPlugInPort.SNAP_TO_DEFAULT, toggleItems); + configToolbar.add(new JLabel(" ")); + configToolbar.add(LangUtil.translate("Continuous Creation"), IPlugInPort.CONTINUOUS_CREATION_KEY, IconLoader.Elements.getIcon(), false); configToolbar.add(LangUtil.translate("Highlight Connected Areas"), IPlugInPort.HIGHLIGHT_CONTINUITY_AREA, IconLoader.LaserPointer.getIcon(), false); configToolbar.add(LangUtil.translate("Sticky Points"), IPlugInPort.STICKY_POINTS_KEY, IconLoader.GraphNodes.getIcon(), true);