[Scummvm-git-logs] scummvm-web master -> 5eae34a512e1acb61f0dd1cbad2c353661e36496
sev-
noreply at scummvm.org
Fri Nov 18 15:58:57 UTC 2022
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm-web' repo located at https://github.com/scummvm/scummvm-web .
Summary:
5eae34a512 DUMPER: Add "Always use MacBinary encoding" option so we can preserve Mac type/creator code metadata for all files.
Commit: 5eae34a512e1acb61f0dd1cbad2c353661e36496
https://github.com/scummvm/scummvm-web/commit/5eae34a512e1acb61f0dd1cbad2c353661e36496
Author: elasota (ejlasota at gmail.com)
Date: 2022-11-18T16:58:53+01:00
Commit Message:
DUMPER: Add "Always use MacBinary encoding" option so we can preserve Mac type/creator code metadata for all files.
Changed paths:
dumper-companion/src/Dumper.tsx
dumper-companion/src/hfs/directory.ts
diff --git a/dumper-companion/src/Dumper.tsx b/dumper-companion/src/Dumper.tsx
index c5fac1fd..3aeebf82 100644
--- a/dumper-companion/src/Dumper.tsx
+++ b/dumper-companion/src/Dumper.tsx
@@ -11,6 +11,7 @@ export type State = {
lang: Language;
busy: boolean;
unicode: boolean;
+ forceMacBinary: boolean;
logs: ComponentChild[];
dumpPercent: number;
lastLogWasDumpPercent: boolean;
@@ -24,6 +25,7 @@ export default class Dumper extends Component<Props, State> {
imageName: null,
lang: Language.EN,
unicode: true,
+ forceMacBinary: false,
busy: false,
logs: [],
dumpPercent: -1,
@@ -57,6 +59,11 @@ export default class Dumper extends Component<Props, State> {
<label for="unicode">Allow Unicode file names</label>
</div>
+ <div>
+ <input disabled={this.state.busy} type="checkbox" id="forceMacBinary" checked={this.state.forceMacBinary} onInput={this.handleForceMacBinary.bind(this)}></input>
+ <label for="forceMacBinary">Always use MacBinary encoding</label>
+ </div>
+
<div>
<button disabled={this.state.busy || this.state.image == null} onClick={this.handleDump.bind(this)}>Dump!</button>
</div>
@@ -109,6 +116,11 @@ export default class Dumper extends Component<Props, State> {
this.setState(() => ({ unicode }));
}}
+ handleForceMacBinary(e: Event): void {{
+ const forceMacBinary = (e.target as HTMLInputElement).checked;
+ this.setState(() => ({ forceMacBinary }));
+ }}
+
handleDump(): void {
this.log(`Loading volume "${this.state.imageName}"...`);
this.setState(() => ({ busy: true }), () => {
@@ -137,7 +149,7 @@ export default class Dumper extends Component<Props, State> {
this.updateDumpPercent(0, async () => {
try {
const zipFS = new fs.FS();
- volume.dumpToZip(zipFS.root, this.state.lang, !this.state.unicode, this.log.bind(this));
+ volume.dumpToZip(zipFS.root, this.state.lang, !this.state.unicode, this.state.forceMacBinary, this.log.bind(this));
const blob = await zipFS.exportBlob({
level: 0,
onprogress: (index, max) => {
diff --git a/dumper-companion/src/hfs/directory.ts b/dumper-companion/src/hfs/directory.ts
index 7507ed2e..65b28fe0 100644
--- a/dumper-companion/src/hfs/directory.ts
+++ b/dumper-companion/src/hfs/directory.ts
@@ -85,13 +85,13 @@ export class AbstractFolder {
return res;
}
- dumpToZip(zipDir: any, lang: Language, puny: boolean, log: (string) => void): void {
+ dumpToZip(zipDir: any, lang: Language, puny: boolean, forceMacBinary: boolean, log: (string) => void): void {
for (const [name, child] of this.items()) {
const encodedName = encodeFileName(name, lang, puny, log);
if (child instanceof AbstractFolder) {
- child.dumpToZip(zipDir.addDirectory(encodedName), lang, puny, log);
+ child.dumpToZip(zipDir.addDirectory(encodedName), lang, puny, forceMacBinary, log);
} else {
- zipDir.addUint8Array(encodedName, child.toBinary(name));
+ zipDir.addUint8Array(encodedName, forceMacBinary ? child.toMacBinary(name) : child.toBinary(name));
}
}
}
More information about the Scummvm-git-logs
mailing list