forked from SMUnlimited/AMAI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
InstallToDir.pl
36 lines (30 loc) · 1.16 KB
/
InstallToDir.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#! /usr/bin/perl5 -w
use strict;
sub process_dir {
my $ver = $_[0];
my $dirname = $_[1];
my $commander = $_[2];
my $filename;
opendir my $DIR, $dirname or die "Could not open $dirname\n";
while ($filename = readdir($DIR)) {
next if $filename eq "." || $filename eq "..";
if ((-d "$dirname/$filename") ) {
print "Installing $ver AMAI to dir $dirname\\$filename\n";
process_dir ($ver, "$dirname\\$filename", $commander);
} elsif ($filename =~ m/\.w3m$/ || $filename =~ m/\.w3x$/ ) {
if (!(defined($commander)) || $commander eq "true") {
print "Installing $ver AMAI and Commander to $dirname/$filename\n";
} else {
print "Installing $ver AMAI without Commander to $dirname/$filename\n";
}
system "MPQEditor htsize \"$dirname/$filename\" 64";
system "MPQEditor a \"$dirname/$filename\" Scripts\\$ver\\*.ai Scripts";
if (!(defined($commander)) || $commander eq "true") {
system "MPQEditor a \"$dirname/$filename\" Scripts\\Blizzard_$ver.j Scripts\\Blizzard.j";
}
system "MPQEditor f \"$dirname/$filename\""
}
}
closedir($DIR);
}
process_dir ($ARGV[0], $ARGV[1], $ARGV[2]);