1 package eu.svjatoslav.instantlauncher.configuration;
4 import java.util.regex.Matcher;
5 import java.util.regex.Pattern;
7 public class FileAssociation implements Comparable<FileAssociation> {
9 public String fileRegex;
11 public FileAssociation() {
14 public FileAssociation(String fileRegex, String command) {
15 this.fileRegex = fileRegex;
16 this.command = command;
20 public int compareTo(FileAssociation o) {
21 return fileRegex.compareTo(o.fileRegex);
24 public boolean matchesFile(File file) {
25 String absolutePath = file.getAbsolutePath();
27 Pattern pattern = Pattern.compile(fileRegex);
28 Matcher matcher = pattern.matcher(absolutePath);
29 return matcher.matches();