mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-11-18 10:08:29 +01:00
first checkin; works
This commit is contained in:
parent
aec9469c6d
commit
3a5ba82339
1 changed files with 80 additions and 0 deletions
80
xwords4/dawg/mkxwdcab.pl
Executable file
80
xwords4/dawg/mkxwdcab.pl
Executable file
|
@ -0,0 +1,80 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
# Script for wrapping an xwd file as a CAB to ease installation.
|
||||
|
||||
use strict;
|
||||
use File::Basename;
|
||||
|
||||
my $force = 0;
|
||||
my $path;
|
||||
|
||||
sub usage() {
|
||||
print STDERR "Usage: $0 [-f] dictName.xwd\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
my $cabwiz = $ENV{"CABWIZPATH"};
|
||||
if ( ! -x $cabwiz ) {
|
||||
print STDERR "Cabwiz app not found or not executable; " .
|
||||
"please define environment variable CABWIZPATH.\n" .
|
||||
"(Hint: search for a file called \"Cabwiz.exe\".)\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
while ( my $parm = shift( @ARGV ) ) {
|
||||
if ( $parm eq "-f" ) { $force = 1; next; }
|
||||
else { $path = $parm; }
|
||||
}
|
||||
|
||||
usage() if !$path;
|
||||
|
||||
my $baseName = basename($path);
|
||||
my $dirName = dirname($path);
|
||||
print STDERR "got baseName: $baseName\n";
|
||||
|
||||
$baseName =~ m|^(.*)\.xwd$|;
|
||||
my $name = $1;
|
||||
usage() if !$name;
|
||||
|
||||
my $infname = $name . ".inf";
|
||||
if ( -f $infname && !$force ) {
|
||||
print STDERR "file $infname already exists and -f flag not passed\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
# build the .inf file
|
||||
open INFFILE, "> $infname";
|
||||
|
||||
print INFFILE <<EOF;
|
||||
[CEStrings]
|
||||
InstallDir=%CE1%\\%AppName%
|
||||
AppName="Crosswords"
|
||||
|
||||
[Strings]
|
||||
CompanyName="Fixed Innovations"
|
||||
|
||||
[Version]
|
||||
Signature="\$Chicago\$"
|
||||
CESignature="\$Windows CE\$"
|
||||
Provider=%CompanyName%
|
||||
|
||||
[SourceDisksNames]
|
||||
1=,"FILES",,$dirName
|
||||
|
||||
[SourceDisksFiles]
|
||||
$baseName=1
|
||||
|
||||
[Files]
|
||||
$baseName
|
||||
|
||||
[DefaultInstall]
|
||||
CopyFiles=Files
|
||||
|
||||
[DestinationDirs]
|
||||
Files=,%InstallDir%
|
||||
EOF
|
||||
|
||||
close INFFILE;
|
||||
|
||||
# Then run it
|
||||
system( "$cabwiz", $infname );
|
Loading…
Reference in a new issue