# HG changeset patch # User Sam # Date 1710000387 -25200 # Node ID 0a1e68f32fca2b2d4ce3dfc3b6486ff6e7096397 # Parent c62f7947d371b1c5053fe5898b2335f77b9e0207 add: shortcut for loading of json files diff -r c62f7947d371 -r 0a1e68f32fca semicongine/resources.nim --- a/semicongine/resources.nim Sat Mar 09 20:30:08 2024 +0700 +++ b/semicongine/resources.nim Sat Mar 09 23:06:27 2024 +0700 @@ -1,4 +1,5 @@ import std/streams +import std/json import std/algorithm import std/strutils import std/sequtils @@ -179,6 +180,9 @@ else: raise newException(Exception, "Unsupported audio file type: " & path) +proc loadJson*(path: string, package = DEFAULT_PACKAGE): JsonNode = + path.loadResource_intern(package = package).readAll().parseJson() + proc loadFont*( path: string, name = "",