fix filesystem race-condition

This commit is contained in:
Peter Ferrie 2021-10-21 23:17:04 -07:00
parent b95005701a
commit 8e14c1805a
5 changed files with 10 additions and 5 deletions

View File

@ -41,5 +41,6 @@ if (!a.fileexists(WScript.Arguments(1)) || a.getfile(WScript.Arguments(1)).datel
source.writeline("!text \"" + ((val >= 0) ? (entries[i].substr(val + 1)) : "") + "\"") source.writeline("!text \"" + ((val >= 0) ? (entries[i].substr(val + 1)) : "") + "\"")
} }
source.close()
new ActiveXObject("wscript.shell").run('cmd /c %acme% -o ' + WScript.Arguments(1) + ' build\\okvs.tmp', 0, 1) new ActiveXObject("wscript.shell").run('cmd /c %acme% -o ' + WScript.Arguments(1) + ' build\\okvs.tmp', 0, 1)
} }

View File

@ -8,14 +8,14 @@ while (!b.atendofstream)
entries.push(b.readline()) entries.push(b.readline())
} }
pre_off = a.getfile(WScript.Arguments(2)).size + a.getfile(WScript.Arguments(0) + "\\STANDARD").size osize = a.getfile(WScript.Arguments(0) + "\\STANDARD").size
osize = pre_off pre_off = a.getfile(WScript.Arguments(2)).size + osize
groups = "*=0\n" + "!le16 " + entries.length + ", 0\n" groups = "*=0\n" + "!le16 " + entries.length + ", 0\n"
for (i = 0; i < entries.length; i++) for (i = 0; i < entries.length; i++)
{ {
c = 0 c = a.getfile(WScript.Arguments(2)).size
size = osize size = osize
if (a.fileexists(WScript.Arguments(0) + "\\" + entries[i])) if (a.fileexists(WScript.Arguments(0) + "\\" + entries[i]))

View File

@ -25,7 +25,9 @@ else
entries.sort() entries.sort()
a.createtextfile("build\\GAMES.SORTED").write(entries.toString().replace(/,/g, "\n")) f = a.createtextfile("build\\GAMES.SORTED")
f.write(entries.toString().replace(/,/g, "\n"))
f.close()
ss_off = a.fileexists(WScript.Arguments(2)) ? a.getFile(WScript.Arguments(2)).size : 0 ss_off = a.fileexists(WScript.Arguments(2)) ? a.getFile(WScript.Arguments(2)).size : 0
groups = "*=0\n" + "!le16 " + entries.length + ", 0\n" groups = "*=0\n" + "!le16 " + entries.length + ", 0\n"

View File

@ -33,4 +33,5 @@ while (!b.atendofstream)
} }
} }
a.createtextfile("build\\GAMES.CONF").write(c.toString().replace(/,/g, "\n"))
a.createtextfile("build\\GAMES.SORTED").write(c.sort().toString().replace(/,/g, "\n")) a.createtextfile("build\\GAMES.SORTED").write(c.sort().toString().replace(/,/g, "\n"))

View File

@ -60,6 +60,7 @@ cscript /nologo bin\subst.js res\HELPTEXT build\HELPTEXT >>build\log
cscript /nologo bin\subst.js res\CREDITS build\CREDITS >>build\log cscript /nologo bin\subst.js res\CREDITS build\CREDITS >>build\log
for %%q in (res\GAMEHELP\*) do cscript /nologo bin\subst.js %%q build\GAMEHELP\%%~nxq >>build\log for %%q in (res\GAMEHELP\*) do cscript /nologo bin\subst.js %%q build\GAMEHELP\%%~nxq >>build\log
rem rem
rem create distribution version of GAMES.CONF without comments or blank lines
rem create a sorted list of game filenames, without metadata or display names rem create a sorted list of game filenames, without metadata or display names
rem rem
cscript /nologo bin\makesorted.js cscript /nologo bin\makesorted.js
@ -133,7 +134,7 @@ rem
%CADIUS% ADDFILE "build\%DISK%" "/%VOLUME%/" "res\TITLE" >>build\log %CADIUS% ADDFILE "build\%DISK%" "/%VOLUME%/" "res\TITLE" >>build\log
%CADIUS% ADDFILE "build\%DISK%" "/%VOLUME%/" "res\COVER" >>build\log %CADIUS% ADDFILE "build\%DISK%" "/%VOLUME%/" "res\COVER" >>build\log
%CADIUS% ADDFILE "build\%DISK%" "/%VOLUME%/" "res\HELP" >>build\log %CADIUS% ADDFILE "build\%DISK%" "/%VOLUME%/" "res\HELP" >>build\log
%CADIUS% ADDFILE "build\%DISK%" "/%VOLUME%/" "res\GAMES.CONF" >>build\log %CADIUS% ADDFILE "build\%DISK%" "/%VOLUME%/" "build\GAMES.CONF" >>build\log
%CADIUS% ADDFILE "build\%DISK%" "/%VOLUME%/" "build\PREFS.CONF" >>build\log %CADIUS% ADDFILE "build\%DISK%" "/%VOLUME%/" "build\PREFS.CONF" >>build\log
%CADIUS% ADDFILE "build\%DISK%" "/%VOLUME%/" "build\CREDITS" >>build\log %CADIUS% ADDFILE "build\%DISK%" "/%VOLUME%/" "build\CREDITS" >>build\log
%CADIUS% ADDFILE "build\%DISK%" "/%VOLUME%/" "build\HELPTEXT" >>build\log %CADIUS% ADDFILE "build\%DISK%" "/%VOLUME%/" "build\HELPTEXT" >>build\log