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;
|
||||
|
||||
import dorkbox.util.FileUtil;
|
||||
import dorkbox.util.LocationResolver;
|
||||
import dorkbox.util.OS;
|
||||
|
||||
|
@ -172,12 +171,7 @@ class ImageUtil {
|
|||
// can be wimpy, only one at a time
|
||||
String hash = hashName(bytes);
|
||||
|
||||
String extension = FileUtil.getExtension(cacheName);
|
||||
if (extension == null) {
|
||||
extension = "";
|
||||
}
|
||||
|
||||
|
||||
String extension = getExtension(cacheName);
|
||||
newFile = new File(TEMP_DIR, "SYSTRAY_" + hash + '.' + extension).getAbsoluteFile();
|
||||
if (SystemTray.isKDE) {
|
||||
// KDE is unique per run, so this prevents buildup
|
||||
|
@ -216,6 +210,17 @@ class ImageUtil {
|
|||
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
|
||||
private static
|
||||
String hashName(byte[] nameChars) {
|
||||
|
|
|
@ -20,7 +20,6 @@ import dorkbox.systemTray.ImageUtil;
|
|||
import dorkbox.systemTray.MenuEntry;
|
||||
import dorkbox.systemTray.SystemTray;
|
||||
import dorkbox.systemTray.SystemTrayMenuAction;
|
||||
import dorkbox.util.FileUtil;
|
||||
import dorkbox.util.SwingUtil;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
|
@ -157,9 +156,9 @@ class SwingMenuEntry implements MenuEntry {
|
|||
|
||||
if (delete) {
|
||||
// now write out the new one
|
||||
String extension = FileUtil.getExtension(imagePath);
|
||||
if (extension == null) {
|
||||
extension = ".png"; // this is just made up
|
||||
String extension = ImageUtil.getExtension(imagePath);
|
||||
if (extension.equals("")) {
|
||||
extension = "png"; // made up
|
||||
}
|
||||
BufferedImage bufferedImage = getBufferedImage(image);
|
||||
try {
|
||||
|
|
Loading…
Reference in New Issue
Block a user