Merge pull request #11000 from igfoo/igfoo/unknown-binary-location

Kotlin: Handle /!unknown-binary-location/... paths specially on Windows
This commit is contained in:
Ian Lynagh
2022-10-27 12:09:32 +01:00
committed by GitHub

View File

@@ -14,7 +14,15 @@ public abstract class PathTransformer {
* canonical, absolute, strings and normalises away Unix/Windows differences.
*/
public String fileAsDatabaseString(File file) {
String path;
String path = file.getPath();
// For a /!unknown-binary-location/... path, on Windows
// the standard code wants to normalise it to
// C:/!unknown-binary-location/...
// which is particularly annoying for cross-platform test
// output. We therefore handle it specially here.
if (path.matches("^[/\\\\]!unknown-binary-location[/\\\\].*")) {
return path.replace('\\', '/');
}
if (Boolean.valueOf(Env.systemEnv().get(Var.SEMMLE_PRESERVE_SYMLINKS)))
path = FileUtil.simplifyPath(file);
else
@@ -43,4 +51,4 @@ public abstract class PathTransformer {
public static PathTransformer std() {
return DEFAULT_TRANSFORMER;
}
}
}