1 var files = new Array("yamy.ini", "104.mayu", "109.mayu", "default.mayu", "emacsedit.mayu", "104on109.mayu", "109on104.mayu", "dot.mayu", "workaround.mayu", "workaround.reg", "readme.txt", "yamy.exe", "yamy32", "yamy32.dll", "yamyd32", "yamy64", "yamy64.dll");
\r
3 var config = WScript.Arguments.Item(0); // "Debug" or "Release"
\r
4 var version = WScript.Arguments.Item(1); // x.yz
\r
5 if (config == null | version == null) {
\r
6 throw new Error("usage: CScirpt.exe makedistrib.js {Debug | Release} <version>");
\r
9 var targetDir = "..\\" + config + "\\";
\r
10 var pkgFile = "yamy-" + version + ".zip";
\r
12 function ProcessFiles(dir, files, process) {
\r
13 for (var i = 0; i < files.length; i++) {
\r
14 process(dir, files[i]);
\r
18 var RemoveFile = function(dir, name) {
\r
19 var path = dir + name;
\r
20 if (fso.FileExists(path)) {
\r
21 fso.DeleteFile(path);
\r
25 var fso = WScript.CreateObject("Scripting.FileSystemObject");
\r
27 throw new Error("can't create File System Object!");
\r
30 var shell = WScript.CreateObject("Shell.Application");
\r
31 if (shell == null) {
\r
32 throw new Error("can't create Shell Application Object!");
\r
35 if (fso.FolderExists(targetDir) == false) {
\r
36 fso.CreateFolder(targetDir);
\r
39 RemoveFile(targetDir, pkgFile);
\r
41 var file = fso.CreateTextFile(targetDir + pkgFile, true);
\r
42 file.Write("PK\x05\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00");
\r
45 var targetZip = shell.NameSpace(fso.GetAbsolutePathName(targetDir + pkgFile));
\r
47 var PackFile = function(dir, name) {
\r
48 var path = dir + name;
\r
49 if (fso.FileExists(path) == false) {
\r
50 RemoveFile(targetDir, pkgFile);
\r
51 throw new Error("can't pack " + path + "!");
\r
53 var item = shell.NameSpace(fso.GetAbsolutePathName(dir)).ParseName(name);
\r
54 var count = targetZip.Items().Count;
\r
55 targetZip.CopyHere(item);
\r
56 while (targetZip.Items().Count != count + 1) {
\r
61 ProcessFiles(targetDir, files, PackFile);
\r