Mercurial > games > semicongine
annotate tests/test_resources.nim @ 1086:4fc591930015
add: steam-assets tooling
author | sam <sam@basx.dev> |
---|---|
date | Fri, 05 Apr 2024 21:41:15 +0700 |
parents | 1ab09f8cc68d |
children | 114f395b9144 |
rev | line source |
---|---|
438 | 1 import std/os |
235
5f6d3511ef79
did: replace zippy with "standard" nim zip, compiled from source, fix some errors
Sam <sam@basx.dev>
parents:
213
diff
changeset
|
2 import std/streams |
438 | 3 import std/strformat |
4 import std/strutils | |
207
81fab407a479
add: some adjustment to the last refactoring :P
Sam <sam@basx.dev>
parents:
diff
changeset
|
5 |
81fab407a479
add: some adjustment to the last refactoring :P
Sam <sam@basx.dev>
parents:
diff
changeset
|
6 import semicongine |
81fab407a479
add: some adjustment to the last refactoring :P
Sam <sam@basx.dev>
parents:
diff
changeset
|
7 |
438 | 8 proc list_all_mods_all_files() = |
9 for package in packages(): | |
10 echo &"Files in package {package}:" | |
11 for i in walkResources(package = package): | |
12 echo " ", i, ": ", i.loadResource(package = package).readAll().len | |
13 | |
14 proc print_ls(dir, package: string, indent = 2) = | |
15 for i in dir.ls(package = package): | |
16 if i.kind == pcDir: | |
17 echo "".align(indent), i.path, "/" | |
18 print_ls(dir.joinPath(i.path), package = package, indent = indent + 2) | |
19 else: | |
20 echo "".align(indent), i.path, ": ", dir.joinPath(i.path).loadResource(package = package).readAll().len | |
21 | |
22 proc list_files() = | |
23 for package in packages(): | |
24 echo &"Recursive walk of package {package}: " | |
25 print_ls("", package = package) | |
26 | |
27 | |
207
81fab407a479
add: some adjustment to the last refactoring :P
Sam <sam@basx.dev>
parents:
diff
changeset
|
28 proc main() = |
438 | 29 echo "Packages available: ", packages() |
30 list_all_mods_all_files() | |
31 list_files() | |
207
81fab407a479
add: some adjustment to the last refactoring :P
Sam <sam@basx.dev>
parents:
diff
changeset
|
32 |
81fab407a479
add: some adjustment to the last refactoring :P
Sam <sam@basx.dev>
parents:
diff
changeset
|
33 when isMainModule: |
81fab407a479
add: some adjustment to the last refactoring :P
Sam <sam@basx.dev>
parents:
diff
changeset
|
34 main() |