refactor(config): 改进了数据目录的获取方式.

补充了通过 user.dir 获取目录路径的方式.
This commit is contained in:
LamGC 2022-04-10 16:26:13 +08:00
parent bc0f3be32c
commit 4210efef3b
Signed by: LamGC
GPG Key ID: 6C5AE2A913941E1D

View File

@ -160,7 +160,10 @@ internal enum class AppPaths(
* 提示: 结尾不带 `/`.
*/
DATA_ROOT(fileSupplier = {
File(System.getProperty(PathConst.PROP_DATA_PATH) ?: System.getenv(PathConst.ENV_DATA_PATH) ?: ".")
File(
System.getProperty(PathConst.PROP_DATA_PATH) ?: System.getenv(PathConst.ENV_DATA_PATH)
?: System.getProperty("user.dir") ?: "."
)
}, initializer = {
val f = file
if (!f.exists()) {