Merge pull request #1635 from Nik-mmzd/asdf-support

Improve SDKMAN support; add ASDF support
This commit is contained in:
Lenny McLennington 2024-01-11 22:44:29 +00:00 committed by GitHub
commit ffcb0c3f41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -448,7 +448,16 @@ QList<QString> JavaUtils::FindJavaPaths()
scanJavaDir("/opt/jdks");
// flatpak
scanJavaDir("/app/jdk");
scanJavaDir(FS::PathCombine(QDir::homePath(), ".sdkman/candidates/java"));
// Default SDKMAN directory can be overwritten via SDKMAN_DIR env var (default $HOME/.sdkman)
// see https://sdkman.io/install
auto sdkmanInstallPath = qEnvironmentVariable("SDKMAN_DIR", FS::PathCombine(QDir::homePath(), ".sdkman"));
scanJavaDir(FS::PathCombine(sdkmanInstallPath, "candidates/java"));
// Default ASDF directory can be overwritten via ASDF_DIR or ASDF_DATA_DIR env vars (default $HOME/.asdf)
// see https://asdf-vm.com/manage/configuration.html#asdf-dir
auto asdfDataPath = qEnvironmentVariable("ASDF_DATA_DIR", qEnvironmentVariable("ASDF_DIR", FS::PathCombine(QDir::homePath(), ".asdf")));
scanJavaDir(FS::PathCombine(asdfDataPath, "installs/java"));
return addJavasFromEnv(javas);
}
#else