4cade/bin/buildss.js

23 lines
759 B
JavaScript
Raw Normal View History

2021-10-12 23:37:45 +00:00
a = new ActiveXObject("scripting.filesystemobject")
entries = []
for (b = new Enumerator(a.GetFolder(WScript.Arguments(0)).files); !b.atEnd(); b.moveNext())
{
entries.push(b.item().name)
}
fx_off = 0
groups = "*=0\n" + "!le16 " + entries.length.toString() + ", 0\n"
for (i = 0; i < entries.length; i++)
{
groups += "!byte " + (1 + 1 + entries[i].length + 3).toString() + "\n" + "!byte " + entries[i].length.toString() + "\n" + "!text \"" + entries[i] + "\"\n" + "!be24 " + fx_off.toString() + "\n"
fx_off += a.getfile(WScript.Arguments(0) + "\\" + entries[i]).size
}
f = a.createtextfile(WScript.Arguments(1))
f.write(groups)
f.close()
new ActiveXObject("wscript.shell").run('cmd /c %acme% -o ' + WScript.Arguments(2) + " " + WScript.Arguments(1))