Update ooo320-m1
[ooovba.git] / solenv / bin / modules / installer / windows / java.pm
blobd609497d710d6a343ac89bb65415f7c0e5173782
1 #*************************************************************************
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 #
5 # Copyright 2008 by Sun Microsystems, Inc.
7 # OpenOffice.org - a multi-platform office productivity suite
9 # $RCSfile: java.pm,v $
11 # $Revision: 1.5 $
13 # This file is part of OpenOffice.org.
15 # OpenOffice.org is free software: you can redistribute it and/or modify
16 # it under the terms of the GNU Lesser General Public License version 3
17 # only, as published by the Free Software Foundation.
19 # OpenOffice.org is distributed in the hope that it will be useful,
20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 # GNU Lesser General Public License version 3 for more details
23 # (a copy is included in the LICENSE file that accompanied this code).
25 # You should have received a copy of the GNU Lesser General Public License
26 # version 3 along with OpenOffice.org. If not, see
27 # <http://www.openoffice.org/license.html>
28 # for a copy of the LGPLv3 License.
30 #*************************************************************************
32 package installer::windows::java;
34 use installer::exiter;
35 use installer::files;
36 use installer::globals;
37 use installer::windows::idtglobal;
39 ####################################################################################
40 # Writing content into RegLocat.idt and AppSearc.idt to find Java on system
41 ####################################################################################
43 sub update_java_tables
45 my ($basedir, $allvariables) = @_;
47 my $reglocatfile = "";
48 my $appsearchfile = "";
50 my $reglocatfilename = $basedir . $installer::globals::separator . "RegLocat.idt";
51 my $appsearchfilename = $basedir . $installer::globals::separator . "AppSearc.idt";
52 my $signaturefilename = $basedir . $installer::globals::separator . "Signatur.idt";
54 if ( -f $reglocatfilename )
56 $reglocatfile = installer::files::read_file($reglocatfilename);
58 else
60 my @reglocattable = ();
61 $reglocatfile = \@reglocattable;
62 installer::windows::idtglobal::write_idt_header($reglocatfile, "reglocat");
65 if ( -f $appsearchfilename )
67 $appsearchfile = installer::files::read_file($appsearchfilename);
69 else
71 my @appsearchtable = ();
72 $appsearchfile = \@appsearchtable;
73 installer::windows::idtglobal::write_idt_header($appsearchfile, "appsearch");
76 if ( -f $signaturefilename )
78 $signaturefile = installer::files::read_file($signaturefilename);
80 else
82 my @signaturetable = ();
83 $signaturefile = \@signaturetable;
84 installer::windows::idtglobal::write_idt_header($signaturefile, "signatur");
87 # Writing content into this tables
88 # Java version is saved in scp project
89 # $installer::globals::javafile was defined in installer::windows::idtglobal::add_childprojects
91 if ( ! $installer::globals::javafile->{'Javaversion'} ) { installer::exiter::exit_program("ERROR: \"Javaversion\" has to be defined in $installer::globals::javafile->{'gid'} in scp project!", "update_java_tables"); }
93 my $javastring = $installer::globals::javafile->{'Javaversion'};
95 my $signature = "JavaReg";
96 my $rootvalue = "2";
97 my $key = "Software\\JavaSoft\\Java Runtime Environment\\" . $javastring;
98 my $name = "JavaHome";
99 my $type = 2;
100 my $property = "JAVAPATH";
102 my $oneline = $signature . "\t" . $rootvalue . "\t" . $key . "\t" . $name . "\t" . $type . "\n";
103 push(@{$reglocatfile}, $oneline);
105 $oneline = $property . "\t" . $signature . "\n";
106 push(@{$appsearchfile}, $oneline);
108 # Saving the files
110 installer::files::save_file($reglocatfilename ,$reglocatfile);
111 my $infoline = "Updated idt file for Java: $reglocatfilename\n";
112 push(@installer::globals::logfileinfo, $infoline);
114 installer::files::save_file($appsearchfilename ,$appsearchfile);
115 $infoline = "Updated idt file for Java: $appsearchfilename\n";
116 push(@installer::globals::logfileinfo, $infoline);
118 installer::files::save_file($signaturefilename ,$signaturefile);
119 $infoline = "Updated idt file: $signaturefilename\n";
120 push(@installer::globals::logfileinfo, $infoline);