# HG changeset patch # User sam # Date 1712925398 -25200 # Node ID 2a1de6cb5282c5a432a25b9fd1207800e34bcdfb # Parent d19400daf303f730185e621f2b5b00aa371ee018 fix: packaging fails if there are no resources, fix: zip-generation diff -r d19400daf303 -r 2a1de6cb5282 semicongine/build.nim --- a/semicongine/build.nim Tue Apr 09 23:57:57 2024 +0700 +++ b/semicongine/build.nim Fri Apr 12 19:36:38 2024 +0700 @@ -21,6 +21,7 @@ let SQLITELIB = currentSourcePath().parentDir().parentDir().joinPath("libs/sqlite3.dll") proc semicongine_builddir*(buildname: string, builddir = "./build"): string = + assert projectName() != "", "Please specify project file as a commandline argument" var platformDir = "unkown" if defined(linux): @@ -82,7 +83,7 @@ proc semicongine_zip*(dir: string) = withdir dir.parentDir: if defined(linux): - exec &"zip -r {dir.lastPathPart} ." + exec &"zip -r {dir.lastPathPart} {dir.lastPathPart}" elif defined(windows): exec &"powershell Compress-Archive * {dir.lastPathPart}" else: diff -r d19400daf303 -r 2a1de6cb5282 semicongine/resources.nim --- a/semicongine/resources.nim Tue Apr 09 23:57:57 2024 +0700 +++ b/semicongine/resources.nim Fri Apr 12 19:36:38 2024 +0700 @@ -124,13 +124,16 @@ const BUILD_RESOURCEROOT* {.strdefine.}: string = "" proc loadResources(): Table[string, Table[string, string]] {.compileTime.} = - assert BUILD_RESOURCEROOT != "", "define BUILD_RESOURCEROOT to build for bundle type 'exe'" - for kind, packageDir in walkDir(BUILD_RESOURCEROOT): - if kind == pcDir: - let package = packageDir.splitPath.tail - result[package] = Table[string, string]() - for resourcefile in walkDirRec(packageDir, relative = true): - result[package][resourcefile.replace('\\', '/')] = staticRead(packageDir.joinPath(resourcefile)) + when BUILD_RESOURCEROOT == "": + {.warning: "BUILD_RESOURCEROOT is empty, no resources will be packaged".} + return + else: + for kind, packageDir in walkDir(BUILD_RESOURCEROOT): + if kind == pcDir: + let package = packageDir.splitPath.tail + result[package] = Table[string, string]() + for resourcefile in walkDirRec(packageDir, relative = true): + result[package][resourcefile.replace('\\', '/')] = staticRead(packageDir.joinPath(resourcefile)) const bundledResources = loadResources() proc loadResource_intern(path: string, package: string): Stream =