mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
CPP-744, CPP-6352: remote toolchain support; WSL: getWslVersion() was removed from WSLUtil
This commit is contained in:
@@ -60,33 +60,8 @@ public class WSLUtil {
|
||||
return StringUtil.isEmpty(localAppDataPath) ? null : localAppDataPath + WSL_ROOT_CHUNK;
|
||||
});
|
||||
|
||||
private static final Pattern WIN_10_VERSION_PATTERN = Pattern.compile(".*(?:\\[Version 10\\.\\d+\\.(\\d+)\\])");
|
||||
private static final int READ_VERSION_TIMEOUT = 10000;
|
||||
private static final int RESOLVE_SYMLINK_TIMEOUT = 10000;
|
||||
|
||||
/**
|
||||
* WSL version equals Windows build number
|
||||
* (https://github.com/Microsoft/BashOnWindows/issues/1728)
|
||||
*/
|
||||
private static final AtomicNullableLazyValue<String> ourWSLVersion = AtomicNullableLazyValue.createValue(() -> {
|
||||
final GeneralCommandLine commandLine = new GeneralCommandLine(ExecUtil.getWindowsShellName(), "/c", "ver");
|
||||
|
||||
try {
|
||||
final ProcessOutput result = ExecUtil.execAndGetOutput(commandLine, READ_VERSION_TIMEOUT);
|
||||
if (result.isTimeout()) return null;
|
||||
|
||||
final String out = result.getStdout().trim();
|
||||
final Matcher matcher = WIN_10_VERSION_PATTERN.matcher(out);
|
||||
if (matcher.find()) {
|
||||
return matcher.group(1);
|
||||
}
|
||||
}
|
||||
catch (ExecutionException e) {
|
||||
LOG.warn(e);
|
||||
}
|
||||
return null;
|
||||
});
|
||||
|
||||
/**
|
||||
* @return bash file or null if not exists
|
||||
*/
|
||||
@@ -102,14 +77,6 @@ public class WSLUtil {
|
||||
return getWSLBashFile() != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return WSL build number or null if it cannot be determined
|
||||
*/
|
||||
@Nullable
|
||||
public static String getWslVersion() {
|
||||
return hasWSL() ? ourWSLVersion.getValue() : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Windows-dependent path for a file, pointed by {@code wslPath} in WSL
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user