mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-05 01:50:56 +07:00
wsl: better check for absolute Windows path, addon fix (IDEA-CR-34321)
This commit is contained in:
@@ -346,6 +346,12 @@ public class WSLDistribution {
|
||||
@Nullable
|
||||
public String getWslPath(@NotNull String windowsPath) {
|
||||
if (FileUtil.isWindowsAbsolutePath(windowsPath)) { // absolute windows path => /mnt/disk_letter/path
|
||||
if (windowsPath.length() > 2) {
|
||||
char separator = windowsPath.charAt(2);
|
||||
if (separator != '/' && separator != '\\') {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return WSL_MNT_ROOT +
|
||||
Character.toLowerCase(windowsPath.charAt(0)) +
|
||||
FileUtil.toSystemIndependentName(windowsPath.substring(2));
|
||||
|
||||
@@ -55,6 +55,7 @@ public class WSLUtilTest {
|
||||
assertWinPath("c:\\foo", "/mnt/c/foo");
|
||||
assertWinPath("c:\\temp\\KeepCase", "/mnt/c/temp/KeepCase");
|
||||
assertWinPath("?:\\temp\\KeepCase", null);
|
||||
assertWinPath("c:c", null);
|
||||
|
||||
assertWinPath("%LOCALAPPDATA%\\lxss\\rootfs\\usr\\something\\include", "/usr/something/include");
|
||||
assertWinPath("%LOCALAPPDATA%\\lxss\\rootfs\\usr\\something\\bin\\gcc", "/usr/something/bin/gcc");
|
||||
|
||||
Reference in New Issue
Block a user