DS-4175: Workaround for symlinks on WSL

``/usr/bin/python`` is symlink in many distros and can't be checked via 9P (``\\wsl$``). Hence, we provide ``Unknown`` for such cases.
See issue comment for more info

(cherry picked from commit 529eec2203f21e91c1ebc4f3df5d9b22ce4fcf3b)

IJ-MR-98852

(cherry picked from commit e4954edbc1d87709387ebaaf0a2cac0f150c5d05)

GitOrigin-RevId: d6b4b955a14e38fe217a20f33e6260c050af0984
This commit is contained in:
Ilya.Kazakevich
2022-11-18 14:51:31 +01:00
committed by intellij-monorepo-bot
parent 03adfecf20
commit 2e6c91c3ea
7 changed files with 66 additions and 4 deletions

View File

@@ -146,7 +146,7 @@ public abstract class PythonSdkFlavor<D extends PyFlavorData> {
}
/**
* False means file is not executable, but true means it is executable or we do not know.
* False means file is not executable, but true means it is executable, or we do not know.
*
* @param fullPath full path on target
*/
@@ -157,6 +157,9 @@ public abstract class PythonSdkFlavor<D extends PyFlavorData> {
}
if (targetEnvConfig instanceof TargetConfigurationReadableFs) {
var fileInfo = ((TargetConfigurationReadableFs)targetEnvConfig).getPathInfo(fullPath);
if (fileInfo instanceof PathInfo.Unknown) {
return true; // We can't be sure if file is executable or not
}
return (fileInfo instanceof PathInfo.RegularFile) && (((PathInfo.RegularFile)fileInfo).getExecutable());
}
// We can't be sure if file is executable or not