DEVTOOLS: Implement macbinary encoding for dumper-companion

This commit is contained in:
Eugene Sandulenko 2021-07-19 12:50:23 +02:00
parent 780d10756c
commit ec344292f0
No known key found for this signature in database
GPG Key ID: 014D387312D34F08

View File

@ -3,6 +3,7 @@
use strict;
use Getopt::Std;
use Encode;
use File::Find;
sub VERSION_MESSAGE() {
print "$0 version 1.0\n"
@ -10,6 +11,7 @@ sub VERSION_MESSAGE() {
sub HELP_MESSAGE();
sub processIso($);
sub processMacbinary();
getopts('hmf:e:');
@ -18,6 +20,11 @@ if ($::opt_h) {
exit 0;
}
if ($::opt_m) {
processMacbinary;
exit 0;
}
if ($::opt_f) {
processIso($::opt_f);
}
@ -96,6 +103,22 @@ sub processIso($) {
print "done\n";
}
sub processMacbinary() {
find( sub {
my $fname = $_;
if (open F, "$fname/..namedfork/rsrc") {
print "Resource in $fname\n";
close F;
system("macbinary encode \"$fname\"");
system("touch -r \"$fname\" \"$fname.bin\"");
system("mv \"$fname.bin\" \"$fname\"");
}
}, ".");
}
sub HELP_MESSAGE() {
print <<EOF;
Usage: $0 [OPTIONS]...