19 package org.sleuthkit.autopsy.directorytree;
21 import java.awt.Desktop;
22 import java.awt.event.ActionEvent;
24 import java.io.IOException;
25 import java.util.logging.Level;
26 import javax.swing.AbstractAction;
27 import org.openide.nodes.Node;
41 final static String[] EXECUTABLE_EXT = {
".exe",
".dll",
".com",
".bat",
".msi",
".reg",
".scr"};
49 int extPos = fileName.lastIndexOf(
'.');
51 boolean isExecutable =
false;
53 String extension = fileName.substring(extPos, fileName.length()).toLowerCase();
54 for (
int i = 0; i < EXECUTABLE_EXT.length; ++i) {
55 if (EXECUTABLE_EXT[i].equals(extension)) {
65 if (!(size > 0) || extPos == -1 || isExecutable) {
66 this.setEnabled(
false);
74 tempPath = tempPath + File.separator + this.
fileObject.getName();
77 File tempFile =
new File(tempPath);
78 if (tempFile.exists()) {
82 tempFile.createNewFile();
84 }
catch (IOException ex) {
86 logger.log(Level.WARNING,
"Can't save to temporary file.", ex);
90 Desktop.getDesktop().open(tempFile);
91 }
catch (IOException ex) {
93 logger.log(Level.WARNING,
"File type not supported.", ex);
97 tempFile.deleteOnExit();
String getTempDirectory()
static< T > long writeToFile(Content content, java.io.File outputFile, ProgressHandle progress, Future< T > worker, boolean source)
static final Logger logger
static Case getCurrentCase()
synchronized static Logger getLogger(String name)
org.sleuthkit.datamodel.AbstractFile fileObject
ExternalViewerAction(String title, Node fileNode)
void actionPerformed(ActionEvent e)