Commit 5f0a5173 authored by Rina Sergeeva's avatar Rina Sergeeva

merge with master

parents 8138c569 73009558
......@@ -148,7 +148,11 @@ public class FxAdminController extends FxController {
fileSearcher = FileSearcher.getInstance();
Thread fileSearcherThread = new Thread(() -> {
<<<<<<< HEAD
Set<File> files = fileSearcher.prepareFiles(root.toPath());
=======
List<File> files = new ArrayList<>(fileSearcher.prepareFiles(root.toPath()));
>>>>>>> master
List<File> peFiles;
if (isPE) {
......
......@@ -113,14 +113,15 @@ public class FileMonitor extends Thread {
Path name = ev.context();
Path child = dir.resolve(name);
fileSearcher.addFile(child.toAbsolutePath().toFile());
// print out event
logger.info(String.format("%s: %s\n", event.kind().name(), child));
if (event.kind() == ENTRY_CREATE)
if (event.kind() == ENTRY_CREATE && !child.toAbsolutePath().toFile().isDirectory()) {
fileSearcher.addFile(child.toAbsolutePath().toFile());
if (event.kind() == ENTRY_DELETE)
}
if (event.kind() == ENTRY_DELETE && !child.toAbsolutePath().toFile().isDirectory()) {
fileSearcher.removeFile(child.toAbsolutePath().toFile());
}
// if directory is created, and watching recursively, then
// register it and its sub-directories
......
......@@ -4,7 +4,8 @@ import java.io.File;
import java.io.IOException;
import java.nio.file.*;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.*;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
public class FileSearcher {
......
......@@ -64,14 +64,6 @@ public class UnzipUtil {
}
String extension = file.getName().substring(file.getName().indexOf("."));
return extension.equals(".zip") || extension.equals(".zipx") || extension.equals(".gzip") || extension.equals(".rar");
// int fileSignature = 0;
// try (RandomAccessFile raf = new RandomAccessFile(file, "r")) {
// fileSignature = raf.readInt();
// } catch (IOException e) {
// logger.error(e.getStackTrace());
// // handle if you like
// }
// return fileSignature == 0x504B0304 || fileSignature == 0x504B0506 || fileSignature == 0x504B0708;
}
private static void write(InputStream inputStream, OutputStream outputStream) throws IOException {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment