mirror of
https://github.com/TermoraDev/termora.git
synced 2026-01-16 02:12:58 +08:00
fix: wsl reg exception
This commit is contained in:
@@ -21,10 +21,11 @@ object WSLSupport {
|
|||||||
|
|
||||||
fun getDistributions(): List<WSLDistribution> {
|
fun getDistributions(): List<WSLDistribution> {
|
||||||
if (isSupported.not()) return emptyList()
|
if (isSupported.not()) return emptyList()
|
||||||
|
val distributions = mutableListOf<WSLDistribution>()
|
||||||
|
|
||||||
|
try {
|
||||||
val baseKeyPath = "Software\\Microsoft\\Windows\\CurrentVersion\\Lxss"
|
val baseKeyPath = "Software\\Microsoft\\Windows\\CurrentVersion\\Lxss"
|
||||||
val guids = Advapi32Util.registryGetKeys(WinReg.HKEY_CURRENT_USER, baseKeyPath)
|
val guids = Advapi32Util.registryGetKeys(WinReg.HKEY_CURRENT_USER, baseKeyPath)
|
||||||
val distributions = mutableListOf<WSLDistribution>()
|
|
||||||
|
|
||||||
for (guid in guids) {
|
for (guid in guids) {
|
||||||
val key = baseKeyPath + "\\" + guid
|
val key = baseKeyPath + "\\" + guid
|
||||||
@@ -50,6 +51,11 @@ object WSLSupport {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
if (log.isWarnEnabled) {
|
||||||
|
log.warn(e.message, e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return distributions
|
return distributions
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user