File tree Expand file tree Collapse file tree 3 files changed +11
-2
lines changed
app/src/main/java/com/osfans/trime Expand file tree Collapse file tree 3 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ object DataManager {
3535 * @return the absolute path of the compiled config file
3636 */
3737 @JvmStatic
38- fun resolvePath (resourceId : String ): String {
38+ fun resolveDeployedResourcePath (resourceId : String ): String {
3939 val defaultPath = File (stagingDir, " $resourceId .yaml" )
4040 if (! defaultPath.exists()) {
4141 val fallbackPath = File (prebuiltDataDir, " $resourceId .yaml" )
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ object SchemaManager {
2424
2525 @JvmStatic
2626 fun init (schemaId : String ) {
27- val raw = File (DataManager .resolvePath (" $schemaId .schema" ))
27+ val raw = File (DataManager .resolveDeployedResourcePath (" $schemaId .schema" ))
2828 .inputStream()
2929 .bufferedReader()
3030 .use { it.readText() }
Original file line number Diff line number Diff line change 11package com.osfans.trime.util.config
22
3+ import com.osfans.trime.data.DataManager
34import timber.log.Timber
45
56/* *
67 * New YAML config parser intended to replace the old one.
78 */
89class Config (private val data : ConfigData = ConfigData ()) {
910
11+ companion object {
12+ fun create (fileName : String ) = Config (
13+ ConfigData ().apply {
14+ loadFromFile(DataManager .resolveDeployedResourcePath(fileName))
15+ },
16+ )
17+ }
18+
1019 fun loadFromFile (fileName : String ) = data.loadFromFile(fileName)
1120
1221 fun isNull (path : String ): Boolean {
You can’t perform that action at this time.
0 commit comments