source: gs2-extensions/open-office/trunk/src/open-office-setup.pl@ 23709

Last change on this file since 23709 was 23709, checked in by ak19, 13 years ago

Minor changes to recently added open-office-setup.pl file, to make it set the additional env variables that setup.bat sets on Windows.

File size: 1.3 KB
Line 
1
2BEGIN {
3 die "GSDLHOME not set\n" unless defined $ENV{'GSDLHOME'};
4 die "GSDLOS not set\n" unless defined $ENV{'GSDLOS'};
5 unshift (@INC, "$ENV{'GSDLHOME'}/perllib");
6 unshift (@INC, "$ENV{'GSDLHOME'}/perllib/cpan");
7}
8
9use Cwd;
10require util;
11
12my $env_ext = "GEXT_OPENOFFICE";
13my $ext_desc = "the Open Office Extension";
14
15if (!defined $ENV{$env_ext}) {
16
17 my $ext_home = cwd();
18 $ENV{$env_ext} = $ext_home;
19
20 my $ext_bin_script = &util::filename_cat($ENV{$env_ext},"bin","script");
21 if (-d $ext_bin_script) {
22 &util::envvar_prepend("PATH",$ext_bin_script);
23 }
24
25 if ($ENV{'GSDLOS'} =~ m/windows/i) {
26 $ENV{'GS_CP_SET'} = "yes";
27 }
28
29 my ($ext_dir,$_prefix_dir) = File::Basename::fileparse($ext_home);
30 # GSDLEXTS always uses : as a separator
31 if (defined $ENV{'GSDLEXTS'}) {
32 $ENV{'GSDLEXTS'} .= ":$ext_dir";
33 }
34 else {
35 $ENV{'GSDLEXTS'} = $ext_dir;
36 }
37
38 print STDERR "+Your environment is now setup for $ext_desc\n";
39}
40else {
41 print STDERR "+Your environment is already setup for $ext_desc\n";
42}
43
44if (scalar(@ARGV>0)) {
45
46 print STDERR "\n";
47
48 my $cmd = join(" ",map {$_ = "\"$_\""} @ARGV);
49
50 if (system($cmd)!=0) {
51 print STDERR "\nError: Failed to run '$cmd'\n";
52 print STDERR "$!\n";
53 }
54}
55
561;
Note: See TracBrowser for help on using the repository browser.