mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
Merge branch 'next' into lang
Conflicts: diylc/diylc-library/lib/diylc-core.jar diylc/diylc-swing/lib/diylc-core.jar diylc/diylc-swing/library/main.jar
This commit is contained in:
@@ -3032,6 +3032,34 @@
|
||||
</org.diylc.appframework.update.Change>
|
||||
</changes>
|
||||
<url>https://github.com/bancika/diy-layout-creator/releases</url>
|
||||
</org.diylc.appframework.update.Version>
|
||||
<org.diylc.appframework.update.Version>
|
||||
<versionNumber>
|
||||
<major>4</major>
|
||||
<minor>6</minor>
|
||||
<build>0</build>
|
||||
</versionNumber>
|
||||
<releaseDate>2020-04-20 00:00:00.000 CET</releaseDate>
|
||||
<name></name>
|
||||
<changes>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>IMPROVEMENT</changeType>
|
||||
<description>Include themes and fonts in OSX app package</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>BUG_FIX</changeType>
|
||||
<description>Some boards (e.g. Breadboard) stop working at certain orientations</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>BUG_FIX</changeType>
|
||||
<description>Component leads on resistors, capacitors, etc disappear when they are very short</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>BUG_FIX</changeType>
|
||||
<description>Prevent "Radial Film Capacitor" from switching to standing mode when end points are too close</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
</changes>
|
||||
<url>https://github.com/bancika/diy-layout-creator/releases</url>
|
||||
</org.diylc.appframework.update.Version>
|
||||
</a>
|
||||
</java.util.Arrays_-ArrayList>
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
*
|
||||
* DIY Layout Creator (DIYLC). Copyright (c) 2009-2018 held jointly by the individual authors.
|
||||
*
|
||||
* This file is part of DIYLC.
|
||||
*
|
||||
* DIYLC is free software: you can redistribute it and/or modify it under the terms of the GNU
|
||||
* General Public License as published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* DIYLC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
* Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with DIYLC. If not, see
|
||||
* <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package org.diylc.utils;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
public class ResourceLoader {
|
||||
|
||||
private static final Logger LOG = Logger.getLogger(ResourceLoader.class);
|
||||
|
||||
public static File[] getFiles(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;
|
||||
LOG.debug("Looking for files in: " + absolutePath);
|
||||
File absoluteFile = new File(absolutePath);
|
||||
return absoluteFile.listFiles();
|
||||
} catch (Exception e) {
|
||||
LOG.error("Error while looking for files in: " + relativePath, e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package org.diylc.utils;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.net.URL;
|
||||
import java.util.List;
|
||||
|
||||
import org.diylc.appframework.update.Change;
|
||||
import org.diylc.appframework.update.Version;
|
||||
import org.diylc.presenter.Presenter;
|
||||
|
||||
import com.thoughtworks.xstream.XStream;
|
||||
import com.thoughtworks.xstream.io.xml.DomDriver;
|
||||
|
||||
public class VersionReader {
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
URL resource = Presenter.class.getResource("update.xml");
|
||||
if (resource != null) {
|
||||
BufferedInputStream in = new BufferedInputStream(resource.openStream());
|
||||
XStream xStream = new XStream(new DomDriver());
|
||||
@SuppressWarnings("unchecked")
|
||||
List<Version> allVersions = (List<Version>) xStream.fromXML(in);
|
||||
Version latest = allVersions.get(allVersions.size() - 1);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (Change c : latest.getChanges())
|
||||
sb.append("**[" + c.getChangeType() + "]** " + c.getDescription()).append("\n");
|
||||
System.out.println(sb.toString());
|
||||
in.close();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println("Error: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user