Skip to content

Commit

Permalink
check if .net core at least 8 is installed
Browse files Browse the repository at this point in the history
  • Loading branch information
Danil0v3s committed Jan 13, 2025
1 parent 9a3c3b4 commit ff28fbf
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions core/native/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ dependencies {

implementation(libs.kotlinx.coroutines.core)
implementation(libs.kotlinx.serialization)
implementation("io.github.z4kn4fein:semver:2.0.0")

implementation(projects.core.common)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package app.cleanmeter.core.os.hardwaremonitor

import app.cleanmeter.core.os.util.isDev
import io.github.z4kn4fein.semver.Version
import io.github.z4kn4fein.semver.toVersion
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
Expand Down Expand Up @@ -46,7 +48,16 @@ object HardwareMonitorProcessManager {

return withContext(Dispatchers.IO) {
val exitCode = process.waitFor()
exitCode == 0 && errOutput.isEmpty()
if (exitCode != 0) {
return@withContext false
}

val hasAtLeastEight = stdOutput
.map { it.split(" ").take(2).let { Pair(it[0], it[1].toVersion()) } } // transform into pairs of [name, version]
.filter { it.first.contains(".NETCore", true) }
.any { it.second >= Version(8,0,0) }

hasAtLeastEight
}
} catch (ex: Exception) {
return false
Expand Down

0 comments on commit ff28fbf

Please sign in to comment.