Skip to content
Snippets Groups Projects
Commit f7fd0e8b authored by Francesco Andreuzzi's avatar Francesco Andreuzzi
Browse files

fixed aaa.* bug

parent db381390
No related branches found
No related tags found
No related merge requests found
...@@ -23,7 +23,9 @@ public class FileManager { ...@@ -23,7 +23,9 @@ public class FileManager {
public static final int ISFILE = 13; public static final int ISFILE = 13;
public static final boolean USE_SCROLL_COMPARE = true; public static final boolean USE_SCROLL_COMPARE = true;
public static final String ALL = "allFiles";
private static final String ASTERISK = "*";
private static final String DOT = Tuils.DOT;
public static int mv(File[] files, File where, boolean su) throws IOException { public static int mv(File[] files, File where, boolean su) throws IOException {
if (files == null || files.length == 0 || where == null) if (files == null || files.length == 0 || where == null)
...@@ -274,16 +276,14 @@ public class FileManager { ...@@ -274,16 +276,14 @@ public class FileManager {
return new DirInfo(file, notFound); return new DirInfo(file, notFound);
} }
public static String wildcard(String path) { public static WildcardInfo wildcard(String path) {
if (path == null || !path.contains("*") || path.contains("/")) if (path == null || !path.contains(ASTERISK) || path.contains("/"))
return null; return null;
// if there is only "*", means that you have to select all files in folder String beforeDot = path.substring(0, path.lastIndexOf(DOT));
String after = path.substring(path.indexOf("*") + 1); String afterDot = path.substring(path.lastIndexOf(DOT) + 1);
if (after.length() == 0)
return ALL;
return after; return new WildcardInfo(beforeDot, afterDot);
} }
public static class DirInfo { public static class DirInfo {
...@@ -295,4 +295,20 @@ public class FileManager { ...@@ -295,4 +295,20 @@ public class FileManager {
this.notFound = nF; this.notFound = nF;
} }
} }
public static class WildcardInfo {
public boolean allNames;
public boolean allExtensions;
public String name;
public String extension;
public WildcardInfo(String name, String extension) {
this.name = name;
this.extension = extension;
allNames = name.length() == 0 || name.equals(ASTERISK);
allExtensions = extension.length() == 0 || extension.equals(ASTERISK);
}
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment