Skip to content

Commit 02d3911

Browse files
committed
Merge pull request #103 from albers/golangmatch-filefilter
Make GoLangMatchFileFilter work on Windows
2 parents f5e8ca1 + eacdd1b commit 02d3911

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src/main/java/com/github/dockerjava/core/GoLangMatchFileFilter.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
*/
44
package com.github.dockerjava.core;
55

6+
import static org.apache.commons.lang.StringUtils.stripStart;
7+
68
import java.io.File;
79
import java.util.List;
810

@@ -23,9 +25,10 @@ public GoLangMatchFileFilter(File base, List<String> patterns) {
2325

2426
@Override
2527
public boolean accept(File file) {
26-
String relativePath = file.getAbsolutePath().replaceFirst(base.getAbsolutePath() + File.separatorChar, "");
27-
28-
boolean match = GoLangFileMatch.match(patterns, relativePath);
28+
String basePath = base.getAbsolutePath() + File.separatorChar;
29+
String relativePath = stripStart(file.getAbsolutePath(), basePath);
30+
31+
boolean match = GoLangFileMatch.match(patterns, relativePath);
2932
return !match;
3033
}
3134

0 commit comments

Comments
 (0)