Put getExtension back into ImageUtil. There were too many dependencies necessary when including FileUtil in the build process
This commit is contained in:
parent
dc41acbbed
commit
3add3419a8
|
@ -15,7 +15,6 @@
|
||||||
*/
|
*/
|
||||||
package dorkbox.systemTray;
|
package dorkbox.systemTray;
|
||||||
|
|
||||||
import dorkbox.util.FileUtil;
|
|
||||||
import dorkbox.util.LocationResolver;
|
import dorkbox.util.LocationResolver;
|
||||||
import dorkbox.util.OS;
|
import dorkbox.util.OS;
|
||||||
|
|
||||||
|
@ -172,12 +171,7 @@ class ImageUtil {
|
||||||
// can be wimpy, only one at a time
|
// can be wimpy, only one at a time
|
||||||
String hash = hashName(bytes);
|
String hash = hashName(bytes);
|
||||||
|
|
||||||
String extension = FileUtil.getExtension(cacheName);
|
String extension = getExtension(cacheName);
|
||||||
if (extension == null) {
|
|
||||||
extension = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
newFile = new File(TEMP_DIR, "SYSTRAY_" + hash + '.' + extension).getAbsoluteFile();
|
newFile = new File(TEMP_DIR, "SYSTRAY_" + hash + '.' + extension).getAbsoluteFile();
|
||||||
if (SystemTray.isKDE) {
|
if (SystemTray.isKDE) {
|
||||||
// KDE is unique per run, so this prevents buildup
|
// KDE is unique per run, so this prevents buildup
|
||||||
|
@ -216,6 +210,17 @@ class ImageUtil {
|
||||||
return newFile.getAbsolutePath();
|
return newFile.getAbsolutePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static
|
||||||
|
String getExtension(final String fileName) {
|
||||||
|
|
||||||
|
String extension = "";
|
||||||
|
int dot = fileName.lastIndexOf('.');
|
||||||
|
if (dot > -1) {
|
||||||
|
extension = fileName.substring(dot + 1);
|
||||||
|
}
|
||||||
|
return extension;
|
||||||
|
}
|
||||||
|
|
||||||
// must be called from synchronized block
|
// must be called from synchronized block
|
||||||
private static
|
private static
|
||||||
String hashName(byte[] nameChars) {
|
String hashName(byte[] nameChars) {
|
||||||
|
|
|
@ -20,7 +20,6 @@ import dorkbox.systemTray.ImageUtil;
|
||||||
import dorkbox.systemTray.MenuEntry;
|
import dorkbox.systemTray.MenuEntry;
|
||||||
import dorkbox.systemTray.SystemTray;
|
import dorkbox.systemTray.SystemTray;
|
||||||
import dorkbox.systemTray.SystemTrayMenuAction;
|
import dorkbox.systemTray.SystemTrayMenuAction;
|
||||||
import dorkbox.util.FileUtil;
|
|
||||||
import dorkbox.util.SwingUtil;
|
import dorkbox.util.SwingUtil;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
|
@ -157,9 +156,9 @@ class SwingMenuEntry implements MenuEntry {
|
||||||
|
|
||||||
if (delete) {
|
if (delete) {
|
||||||
// now write out the new one
|
// now write out the new one
|
||||||
String extension = FileUtil.getExtension(imagePath);
|
String extension = ImageUtil.getExtension(imagePath);
|
||||||
if (extension == null) {
|
if (extension.equals("")) {
|
||||||
extension = ".png"; // this is just made up
|
extension = "png"; // made up
|
||||||
}
|
}
|
||||||
BufferedImage bufferedImage = getBufferedImage(image);
|
BufferedImage bufferedImage = getBufferedImage(image);
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user