# HG changeset patch # User Sam # Date 1710000387 -25200 # Node ID 3f220c2b4076fcd6c250d0532d89ab75bf405058 # Parent 9e621b1116b9fa418204d971040e85335717aec0 add: shortcut for loading of json files diff -r 9e621b1116b9 -r 3f220c2b4076 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 = "",