Skip to content

Commit

Permalink
Escape backslashes when finding a pattern. Closes #634.
Browse files Browse the repository at this point in the history
  • Loading branch information
melissalinkert committed Jan 4, 2011
1 parent 48a5c38 commit 344fc41
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions components/bio-formats/src/loci/formats/FilePattern.java
Expand Up @@ -437,6 +437,14 @@ else if (p == null) {
}
}
sb.append(q > 0 ? name.substring(endList[q - 1]) : name);

for (int i=0; i<sb.length(); i++) {
if (sb.charAt(i) == '\\') {
sb.insert(i, '\\');
i++;
}
}

return sb.toString();
}

Expand Down Expand Up @@ -560,6 +568,11 @@ private void buildFiles(String prefix, int ndx, List<String> fileList) {
if (blocks.length == 0) {
// regex pattern

if (new Location(pattern).exists()) {
fileList.add(pattern);
return;
}

String[] files = null;
int end = pattern.lastIndexOf(File.separator) + 1;
String dir = pattern.substring(0, end);
Expand Down

0 comments on commit 344fc41

Please sign in to comment.