Kotlin: Handle /modules/... paths specially too

On Windows, we don't want a C: prefix on these either.
This commit is contained in:
Ian Lynagh
2022-10-27 12:24:28 +01:00
parent 0a470b0864
commit bafa80667c

View File

@@ -15,12 +15,12 @@ public abstract class PathTransformer {
*/ */
public String fileAsDatabaseString(File file) { public String fileAsDatabaseString(File file) {
String path = file.getPath(); String path = file.getPath();
// For a /!unknown-binary-location/... path, on Windows // For /!unknown-binary-location/... and /modules/...
// the standard code wants to normalise it to // paths, on Windows the standard code wants to
// C:/!unknown-binary-location/... // normalise them to e.g. C:/!unknown-binary-location/...
// which is particularly annoying for cross-platform test // which is particularly annoying for cross-platform test
// output. We therefore handle it specially here. // output. We therefore handle them specially here.
if (path.matches("^[/\\\\]!unknown-binary-location[/\\\\].*")) { if (path.matches("^[/\\\\](!unknown-binary-location|modules)[/\\\\].*")) {
return path.replace('\\', '/'); return path.replace('\\', '/');
} }
if (Boolean.valueOf(Env.systemEnv().get(Var.SEMMLE_PRESERVE_SYMLINKS))) if (Boolean.valueOf(Env.systemEnv().get(Var.SEMMLE_PRESERVE_SYMLINKS)))