-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support using EXPAND.EXE as well as EXTRACT.EXE for testing
- Loading branch information
Showing
5 changed files
with
100 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/usr/bin/perl -w | ||
# put expand.exe and dpx.dll (or a link to them) into this directory | ||
# for this script to work. | ||
# | ||
# NOTE: when a cabinet only contains one file, expand.exe fails to | ||
# preserve its filename, it renames the output after the source cabinet | ||
|
||
use strict; | ||
use File::Temp qw(tempdir); | ||
use Cwd qw(cwd); | ||
|
||
my $expand = $0; $expand =~ s{[^/]+$}{expand.exe}; | ||
my $HDR1 = 'Microsoft (R) File Expansion Utility'; | ||
my $HDR2 = 'Copyright (c) Microsoft Corp'; | ||
|
||
my $dir = tempdir("./.tempXXXX", CLEANUP => 1) . '/extradir'; | ||
mkdir $dir; | ||
$ENV{LANG} = 'C'; | ||
$ENV{WINEPREFIX} = "$ENV{HOME}/.wine64"; | ||
$ENV{WINEARCH} = 'win64'; | ||
|
||
for my $cab (@ARGV) { | ||
my @files; | ||
print "*** $cab\n"; | ||
for (`wine $expand $cab -F:* $dir 2>&1`) { | ||
s/\015?\012$//s; # remove line endings | ||
next if /^(\Q$HDR1\E|\Q$HDR2\E|\s*$|Expanding Files |Progress: |\d+ files total)/; | ||
if (/^Adding \Q$dir\E\\(.+) to Extraction Queue$/) { | ||
my $file = $1; | ||
$file =~ s{\\}{/}g; | ||
$file =~ s{^/+}{}; | ||
push @files, $file; | ||
} | ||
else { | ||
print STDERR "$_\n"; | ||
} | ||
} | ||
|
||
next unless @files; | ||
my $olddir = cwd(); | ||
chdir $dir; | ||
system 'md5sum', @files; | ||
chdir $olddir; | ||
} |