From 5f4e5867c1b3ba4af5f9f19031d322daad75e95e Mon Sep 17 00:00:00 2001 From: Jeff Parsons Date: Thu, 6 Jul 2017 15:04:59 -0700 Subject: [PATCH] Provide some control over DiskDump's normalize option --- modules/diskdump/lib/diskdump.js | 11 ++++++----- tests/pcx86/vga/README.md | 8 ++++---- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/modules/diskdump/lib/diskdump.js b/modules/diskdump/lib/diskdump.js index ca32a48f6..eda559d9e 100644 --- a/modules/diskdump/lib/diskdump.js +++ b/modules/diskdump/lib/diskdump.js @@ -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; } diff --git a/tests/pcx86/vga/README.md b/tests/pcx86/vga/README.md index c0ff056be..d21710b66 100644 --- a/tests/pcx86/vga/README.md +++ b/tests/pcx86/vga/README.md @@ -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 VGA Tests (Black Book) ``` -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.