2006-04-30 23:52:17 +02:00
|
|
|
#!/usr/bin/perl
|
|
|
|
|
|
|
|
# Script for turning the Crosswords executable into a cab, along with
|
|
|
|
# a shortcut in the games menu
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
|
|
|
|
my $userName = "Crosswords.exe";
|
|
|
|
|
|
|
|
sub main() {
|
|
|
|
my $provider = "\"Crosswords project\"";
|
|
|
|
|
2009-12-27 22:33:53 +01:00
|
|
|
usage() if 1 > @ARGV;
|
2006-04-30 23:52:17 +02:00
|
|
|
|
|
|
|
my $path = shift @ARGV;
|
2009-12-27 22:33:53 +01:00
|
|
|
my $dict = shift @ARGV;
|
|
|
|
if ( ! $dict ) {
|
|
|
|
$dict = "../../../dawg/English/BasEnglish2to8.xwd";
|
|
|
|
}
|
2006-04-30 23:52:17 +02:00
|
|
|
|
|
|
|
usage() unless $path =~ m|.exe$|;
|
|
|
|
|
|
|
|
die "$path not found\n" unless -f $path;
|
|
|
|
|
|
|
|
my $cabname = `basename $path`;
|
|
|
|
chomp $cabname;
|
|
|
|
|
|
|
|
# Create a link. The format, says Shaun, is
|
|
|
|
# <number of characters>#command line<no carriage return or line feed>
|
|
|
|
|
|
|
|
$userName = $cabname unless $userName;
|
|
|
|
my $cmdline = "\"\\Program Files\\Crosswords\\" . $userName . "\"";
|
|
|
|
my $cmdlen = length( $cmdline );
|
|
|
|
|
|
|
|
$cabname =~ s/.exe$//;
|
|
|
|
my $linkName = "Crosswords.lnk";
|
|
|
|
open LINKFILE, "> $linkName";
|
|
|
|
print LINKFILE $cmdlen, "#", $cmdline;
|
|
|
|
close LINKFILE;
|
|
|
|
|
|
|
|
my $fname = "/tmp/file$$.list";
|
|
|
|
|
|
|
|
# see this url for %CE5% and other definitions:
|
|
|
|
# http://msdn.microsoft.com/library/default.asp?url=/library/en-us/DevGuideSP/html/sp_wce51consmartphonewindowscestringsozup.asp
|
|
|
|
|
|
|
|
open FILE, "> $fname";
|
|
|
|
|
|
|
|
my $tmpfile = "/tmp/$userName";
|
|
|
|
`cp $path $tmpfile`;
|
|
|
|
print FILE "$tmpfile ";
|
2009-10-20 06:07:16 +02:00
|
|
|
print FILE '%CE1%\\\\Crosswords', "\n";
|
2006-04-30 23:52:17 +02:00
|
|
|
|
2009-12-27 22:33:53 +01:00
|
|
|
print FILE "$dict ";
|
2009-10-20 06:07:16 +02:00
|
|
|
print FILE '%CE1%\\\\Crosswords', "\n";
|
2006-04-30 23:52:17 +02:00
|
|
|
|
2008-05-12 04:51:22 +02:00
|
|
|
# print FILE "$ENV{'CEOPT_ROOT'}/opt/mingw32ce/arm-wince-mingw32ce/bin/mingwm10.dll ";
|
|
|
|
# print FILE '%CE2%\\mingwm10.dll', "\n";
|
2008-02-16 21:26:47 +01:00
|
|
|
|
2006-04-30 23:52:17 +02:00
|
|
|
print FILE "$linkName ";
|
|
|
|
print FILE '%CE14%', "\n";
|
|
|
|
|
|
|
|
close FILE;
|
|
|
|
|
|
|
|
my $appname = $cabname;
|
2008-02-16 21:26:47 +01:00
|
|
|
$cabname .= ".cab";
|
2006-04-30 23:52:17 +02:00
|
|
|
|
2009-10-21 05:39:23 +02:00
|
|
|
my $cmd = "pocketpc-cab -p $provider -a $appname "
|
2006-04-30 23:52:17 +02:00
|
|
|
. "$fname $cabname";
|
2008-02-16 21:26:47 +01:00
|
|
|
print( STDERR $cmd, "\n");
|
2006-04-30 23:52:17 +02:00
|
|
|
`$cmd`;
|
|
|
|
|
|
|
|
unlink $linkName, $tmpfile;
|
|
|
|
}
|
|
|
|
|
|
|
|
sub usage() {
|
2009-12-27 22:33:53 +01:00
|
|
|
print STDERR "usage: $0 path/to/xwords4.exe [path/to/dict.xwd]\n";
|
2006-04-30 23:52:17 +02:00
|
|
|
exit 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
main();
|