changeset 1359:49a7d05d3f28 main

add: support to "import" unknown file types via plain copy
author sam <sam@basx.dev>
date Sun, 03 Nov 2024 17:01:08 +0700
parents fe9a8922333c
children 48df70e8aeed
files semicongine/build.nim
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/semicongine/build.nim	Sat Nov 02 23:40:32 2024 +0700
+++ b/semicongine/build.nim	Sun Nov 03 17:01:08 2024 +0700
@@ -134,6 +134,7 @@
     return
   var meshfiles: seq[(string, string)]
   var audiofiles: seq[(string, string)]
+  var copies: seq[(string, string)]
 
   for (target_rel, source_rel) in resourceMap:
     let target = thisDir().joinPath(target_rel)
@@ -147,12 +148,16 @@
       elif source.endsWith("mp3") or source.endsWith("ogg") or source.endsWith("wav"):
         audiofiles.add (source, target)
       else:
-        raise newException(Exception, &"unkown file type: {source}")
+        copies.add (source, target)
       target.parentDir().mkDir()
     else:
       echo &"{target} is up-to-date"
+
   import_meshes meshfiles
   import_audio audiofiles
+  for (src, dst) in copies:
+    echo &"copy {src} -> {dst}"
+    src.cpFile(dst)
 
 # for steam-buildscript docs see https://partner.steamgames.com/doc/sdk/uploading
 proc semicongine_steam_upload*(steamaccount, password, buildscript: string) =