updated git and svn scripts
[xrzperl.git] / wineapp
blob6b743d398244ad49dd062cf5482d7c23c81a8589
1 #!/usr/bin/perl -w
2 ###APPNAME: wineapp
3 ###APPAUTHOR: xiaoranzzz
4 ###APPDATE: 2009-06-26 20:30:28
5 ###APPVER: 0.1
6 ###APPDESC: wineapp
7 ###APPUSAGE:
8 ###APPEXAMPLE: wineapp
9 ###APPOPTION:
10 use strict;
12 #ENV variable MUST be defined somewhere,
13 #FOR perl to search modules from,
14 #OR nothing will work
15 use lib $ENV{XR_PERL_MODULE_DIR};
17 use MyPlace::Script::Usage qw/help_required help_even_empty/;
18 #exit 0 if(help_required($0,@ARGV));
19 exit 0 if(help_even_empty($0,@ARGV));
21 my $appdir="/myplace/wine/public/apps";
22 my $name = shift;
23 $name = "$name.exe" unless($name =~ /\.(:?dll|exe)$/i);
24 my @props;
25 print STDERR "find $appdir -iname $name\n";
26 open FI,"-|","find",$appdir,"-iname", $name or die("$!\n");
27 while(<FI>) {
28 chomp;
29 push @props,$_;
31 close FI;
32 my $select;
33 if(@props>1) {
34 my $idx;
35 print ":@props program matched:\n";
36 foreach(@props) {
37 $idx++;
38 printf "[%03d]:%s\n",$idx,$_;
40 print "Please select (1-$idx):";
41 $idx = <STDIN>;
42 chomp $idx;
43 if($idx =~ /^[0-9]+$/ and $idx>=1 and $idx<=@props) {
44 $select = $props[$idx-1];
46 else {
47 print "Invalid choice.\n";
48 exit 1;
51 else {
52 $select = $props[0];
55 if($select) {
56 if($select =~ /\.dll$/) {
57 print STDERR "regsvr32 $select\n";
58 exec "regsvr32",$select;
60 else {
61 print STDERR "cn_wine $select\n";
62 exec "cn_wine","$select";
65 exit 0;