File tree Expand file tree Collapse file tree 3 files changed +19
-13
lines changed Expand file tree Collapse file tree 3 files changed +19
-13
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ plugins {
1010dependencies {
1111 // Project "app" depends on project "utils". (Project paths are separated with ":", so ":utils" refers to the top-level "utils" project.)
1212 implementation(project(" :utils" ))
13+ implementation(project(" :lib" ))
1314}
1415
1516application {
Original file line number Diff line number Diff line change 11package org.json5.app
22
3- import org. json5.utils.Printer
3+ import io.github. json5.kotlin.JSON5
44
5- // TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or
6- // click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
75fun main () {
8- val name = " Kotlin"
9- // TIP Press <shortcut actionId="ShowIntentionActions"/> with your caret at the highlighted text
10- // to see how IntelliJ IDEA suggests fixing it.
11- val message = " Hello, " + name + " !"
12- val printer = Printer (message)
13- printer.printMessage()
6+ val json5files = listOf (
7+ " empty-json.json5" ,
8+ )
149
15- for (i in 1 .. 5 ) {
16- // TIP Press <shortcut actionId="Debug"/> to start debugging your code. We have set one <icon src="AllIcons.Debugger.Db_set_breakpoint"/> breakpoint
17- // for you, but you can always add more by pressing <shortcut actionId="ToggleLineBreakpoint"/>.
18- println (" i = $i " )
10+ json5files.forEach { fileName ->
11+ println (" Processing file: $fileName " )
12+ // Load the file from resources using the classloader
13+ val resourceStream = object {}.javaClass.getResourceAsStream(" /$fileName " )
14+
15+ if (resourceStream != null ) {
16+ val content = resourceStream.bufferedReader().use { it.readText() }
17+ JSON5 .parse(content).also { parsed ->
18+ println (" Parsed JSON5: $parsed " )
19+ }
20+ } else {
21+ println (" Error: Could not find resource: $fileName " )
22+ }
1923 }
2024}
Original file line number Diff line number Diff line change 1+ { }
You can’t perform that action at this time.
0 commit comments