embedded icon for linux
This commit is contained in:
parent
5841d45b4c
commit
effadc84fe
@ -15,7 +15,7 @@ import java.io.InputStreamReader;
|
|||||||
*/
|
*/
|
||||||
public class MainApp {
|
public class MainApp {
|
||||||
|
|
||||||
public static final String APP_VERSION = "1.2.2";
|
public static final String APP_VERSION = "1.2.3";
|
||||||
|
|
||||||
public enum OS {
|
public enum OS {
|
||||||
WINDOWS, LINUX, MACOS, UNKNOWN
|
WINDOWS, LINUX, MACOS, UNKNOWN
|
||||||
|
|||||||
@ -3103,11 +3103,20 @@ public class FilePanelTab extends JPanel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean isExecutableWithEmbeddedIcon(FileItem item, FileSpecificIcon.Type fileType) {
|
private boolean isExecutableWithEmbeddedIcon(FileItem item, FileSpecificIcon.Type fileType) {
|
||||||
if (MainApp.CURRENT_OS != MainApp.OS.WINDOWS || item == null || fileType != FileSpecificIcon.Type.EXEC) {
|
if (item == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
File file = item.getFile();
|
File file = item.getFile();
|
||||||
return file != null && file.isFile() && file.exists();
|
if (file == null || !file.isFile() || !file.exists()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (MainApp.CURRENT_OS == MainApp.OS.WINDOWS) {
|
||||||
|
return fileType == FileSpecificIcon.Type.EXEC;
|
||||||
|
}
|
||||||
|
if (MainApp.CURRENT_OS == MainApp.OS.LINUX) {
|
||||||
|
return fileType == FileSpecificIcon.Type.EXEC || file.canExecute();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Icon getExecutableEmbeddedIcon(FileItem item) {
|
private Icon getExecutableEmbeddedIcon(FileItem item) {
|
||||||
@ -3815,4 +3824,3 @@ public class FilePanelTab extends JPanel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -667,7 +667,17 @@ public class MainWindow extends JFrame {
|
|||||||
|
|
||||||
private Icon getToolbarShortcutIcon(File target) {
|
private Icon getToolbarShortcutIcon(File target) {
|
||||||
FileSpecificIcon.Type fileType = FileSpecificIcon.getFileType(target.getName());
|
FileSpecificIcon.Type fileType = FileSpecificIcon.getFileType(target.getName());
|
||||||
if (MainApp.CURRENT_OS == MainApp.OS.WINDOWS && fileType == FileSpecificIcon.Type.EXEC && target.isFile()) {
|
boolean isExecutableWithEmbeddedIcon = false;
|
||||||
|
|
||||||
|
if (target.isFile()) {
|
||||||
|
if (MainApp.CURRENT_OS == MainApp.OS.WINDOWS) {
|
||||||
|
isExecutableWithEmbeddedIcon = fileType == FileSpecificIcon.Type.EXEC;
|
||||||
|
} else if (MainApp.CURRENT_OS == MainApp.OS.LINUX) {
|
||||||
|
isExecutableWithEmbeddedIcon = fileType == FileSpecificIcon.Type.EXEC || target.canExecute();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isExecutableWithEmbeddedIcon) {
|
||||||
try {
|
try {
|
||||||
Icon systemIcon = FileSystemView.getFileSystemView().getSystemIcon(target);
|
Icon systemIcon = FileSystemView.getFileSystemView().getSystemIcon(target);
|
||||||
if (systemIcon != null) {
|
if (systemIcon != null) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user