mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-22 01:11:42 +00:00
[wpilibj] Filesystem.getDeployDirectory(): Strip JNI path from user.dir (#5317)
Fixes https://www.chiefdelphi.com/t/filesystem-getdeploydirectory-returning-wrong-location-how-to-fix/427292 when unit tests are run with VS Code's java test runner due to VS Code extension setting working directory which changes user.dir.
This commit is contained in:
@@ -23,7 +23,13 @@ public final class Filesystem {
|
||||
* @return The current working directory (launch directory)
|
||||
*/
|
||||
public static File getLaunchDirectory() {
|
||||
return new File(System.getProperty("user.dir")).getAbsoluteFile();
|
||||
// workaround for
|
||||
// https://www.chiefdelphi.com/t/filesystem-getdeploydirectory-returning-wrong-location-how-to-fix/427292
|
||||
String path =
|
||||
System.getProperty("user.dir")
|
||||
.replace(
|
||||
File.separator + "build" + File.separator + "jni" + File.separator + "release", "");
|
||||
return new File(path).getAbsoluteFile();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user