Commit 9d1526f2 authored by Alexander Diewald's avatar Alexander Diewald

CLI-Prj-Import: Fix Wildcard Support @Windows

Issue-Ref: 3993
Issue-Url: default avatarAlexander Diewald <>
parent b25550d4 3d5b601f3d65950cf63d979692608887abcb9eb7 GREEN 95af1f2d92bd41d88940d5b074561e0e7c789238 YELLOW
......@@ -15,8 +15,11 @@
package org.fortiss.af3.project.cli;
import static;
import static java.util.Arrays.asList;
import static;
import static org.apache.commons.lang3.StringUtils.lastIndexOf;
import static org.apache.commons.lang3.StringUtils.substring;
import static org.eclipse.emf.common.util.URI.createFileURI;
import static org.fortiss.af3.project.AF3Project.AF3_PRJ_SUFFIX;
import static org.fortiss.af3.project.utils.FileUtils.getDefaultGeneralProjectURI;
......@@ -27,8 +30,6 @@ import static org.fortiss.tooling.kernel.utils.LoggingUtils.error;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Collection;
......@@ -74,11 +75,15 @@ public class AF3ProjectImportHandler implements ICommandLineSwitchHandler {
// Import files matching the regexp. Supports single files, too.
URI importDirURI = Paths.get(importRegExp).getParent().toUri();
File importDir = new File(importDirURI);
String fileRegExp = Paths.get(importRegExp).getFileName().toString();
// NOTE: Operating on strings directly with indices is required to split the input string
// without interpreting it. Otherwise, the windows JDK parts complain due its separator
// choice and missing wildcard support.
int fileSubStrPos = lastIndexOf(importRegExp, separator);
String fileStr = substring(importRegExp, fileSubStrPos + separator.length());
String dirStr = substring(importRegExp, 0, fileSubStrPos);
File importDir = new File(dirStr);
WildcardFileFilter fileFilter =
new WildcardFileFilter(asList(fileRegExp, "." + AF3_PRJ_SUFFIX));
new WildcardFileFilter(asList(fileStr, "." + AF3_PRJ_SUFFIX));
return asList(importDir.listFiles((FileFilter)fileFilter));
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment