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

fixed wildcard problem

parent 20eb09bf
Branches
Tags
No related merge requests found
...@@ -277,13 +277,22 @@ public class FileManager { ...@@ -277,13 +277,22 @@ public class FileManager {
} }
public static WildcardInfo wildcard(String path) { public static WildcardInfo wildcard(String path) {
if (path == null || !path.contains(ASTERISK) || path.contains("/")) if (path == null || !path.contains(ASTERISK) || path.contains(File.separator)) {
return null; return null;
}
String beforeDot = path.substring(0, path.lastIndexOf(DOT)); if(path.trim().equals(ASTERISK)) {
String afterDot = path.substring(path.lastIndexOf(DOT) + 1); return new WildcardInfo(true);
}
int dot = path.lastIndexOf(DOT);
try {
String beforeDot = path.substring(0, dot);
String afterDot = path.substring(dot + 1);
return new WildcardInfo(beforeDot, afterDot); return new WildcardInfo(beforeDot, afterDot);
} catch (Exception e) {
return null;
}
} }
public static class DirInfo { public static class DirInfo {
...@@ -310,5 +319,12 @@ public class FileManager { ...@@ -310,5 +319,12 @@ public class FileManager {
allNames = name.length() == 0 || name.equals(ASTERISK); allNames = name.length() == 0 || name.equals(ASTERISK);
allExtensions = extension.length() == 0 || extension.equals(ASTERISK); allExtensions = extension.length() == 0 || extension.equals(ASTERISK);
} }
public WildcardInfo(boolean all) {
if(all) {
this.allExtensions = all;
this.allNames = all;
}
}
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment