[build] Fix build when local.properties not found

This commit is contained in:
Him188 2022-08-26 16:42:18 +08:00
parent f87c142a69
commit eb892da093
No known key found for this signature in database
GPG Key ID: BA439CDDCF652375
2 changed files with 2 additions and 2 deletions

View File

@ -31,7 +31,7 @@ private lateinit var localProperties: Properties
private fun Project.loadLocalPropertiesIfAbsent() {
if (::localProperties.isInitialized) return
localProperties = Properties().apply {
rootProject.projectDir.resolve("local.properties").bufferedReader().use {
rootProject.projectDir.resolve("local.properties").takeIf { it.exists() }?.bufferedReader()?.use {
load(it)
}
}

View File

@ -33,7 +33,7 @@ rootProject.name = "mirai"
val localProperties = Properties().apply {
rootProject.projectDir.resolve("local.properties").bufferedReader().use {
rootProject.projectDir.resolve("local.properties").takeIf { it.exists() }?.bufferedReader()?.use {
load(it)
}
}