Provide some control over DiskDump's normalize option

This commit is contained in:
Jeff Parsons 2017-07-06 15:04:59 -07:00 committed by Jeff Parsons
commit 5f4e5867c1
2 changed files with 10 additions and 9 deletions

View file

@ -75,8 +75,8 @@ var logFile = null;
/*
* fNormalize attempts to enforce consistency across multiple dump requests, including the order of files within every
* directory, the use of hard-coded volume label timestamps, replacement of line-endings in text files, etc. And since
* I assume that normalization is a wonderful thing, I don't provide any UI for turning it off.
* directory, the use of hard-coded volume label timestamps, replacement of line-endings in text files, etc. It can
* turned on here or with the experimental "--normalize" command-line option.
*/
var fNormalize = false;
@ -344,6 +344,7 @@ function DiskDump(sDiskPath, asExclude, sFormat, fComments, sSize, sServerRoot,
this.fXDFSupport = (argv && argv['xdf']);
this.sLabel = (argv && argv['label']);
this.forceBPB = (argv && argv['forceBPB']);
this.fNormalize = fNormalize || (argv && argv['normalize']);
/*
* The dump operation itself doesn't care about sManifestFile, but we DO need some indication
@ -1617,7 +1618,7 @@ DiskDump.prototype.buildManifestInfo = function(sImage)
*/
DiskDump.prototype.isTextFile = function(sFileName)
{
if (fNormalize) {
if (this.fNormalize) {
for (var i = 0; i < DiskDump.asTextFileExts.length; i++) {
if (str.endsWith(sFileName, DiskDump.asTextFileExts[i])) return true;
}
@ -1675,7 +1676,7 @@ DiskDump.prototype.readDir = function(sDir, fRoot, done)
* file name order that I was originally seeing may have simply been due to out-of-order fs.stat()
* calls, because I used to call addManifestInfo() in the callback.
*/
if (fNormalize) asFiles.sort();
if (obj.fNormalize) asFiles.sort();
for (iFile = 0; iFile < asFiles.length; iFile++) {
var sFileName = asFiles[iFile];
@ -1969,7 +1970,7 @@ DiskDump.prototype.buildVolLabel = function(sDir)
*
* UPDATE: I'm not sure I care about that anymore. Time-stamping the created disk image seems more useful.
*/
fileInfo.FILE_TIME = fNormalize? new Date(1981, 7, 12, 12) : new Date();
fileInfo.FILE_TIME = /* this.fNormalize? new Date(1981, 7, 12, 12) : */ new Date();
this.validateTime(fileInfo.FILE_TIME);
fileInfo.FILE_SIZE = 0;
}

View file

@ -105,7 +105,7 @@ built from the sources in this directory:
The "VGA Tests (Black Book)" disk image (VGABIN) was built with this command:
diskdump --dir=bin --format=json --output=VGABIN.json
diskdump --dir=bin --format=json --output=VGABIN.json --normalize
Alternatively, if *path* refers to a directory (ending with a slash) instead of a disk image, the PCjs client will ask
the PCjs web server to enumerate the contents of that directory and send back a JSON-encoded disk image containing all
@ -116,11 +116,11 @@ burden on the server, it's best to do this only when running PCjs from a local P
<disk path="/tests/pcx86/vga/">VGA Tests (Black Book)</disk>
```
One advantage of using [DiskDump](/modules/diskdump/) is that it automatically converts linefeeds in known text files
(including ASM files) into DOS-compatible CR/LF sequences.
One advantage of using [DiskDump](/modules/diskdump/) with *--normalize* is that it automatically converts linefeeds
in known text files (including ASM files) into DOS-compatible CR/LF sequences.
VGA "Black Book" Test Machine
---
-----------------------------
The [Compaq DeskPro 386](/devices/pcx86/machine/compaq/deskpro386/vga/2048kb/) machine below loads the
"VGA Tests (Black Book)" disk from the PCjs [Library](/disks/pcx86/library.xml) disk collection into Drive B.