1#**************************************************************
2#
3#  Licensed to the Apache Software Foundation (ASF) under one
4#  or more contributor license agreements.  See the NOTICE file
5#  distributed with this work for additional information
6#  regarding copyright ownership.  The ASF licenses this file
7#  to you under the Apache License, Version 2.0 (the
8#  "License"); you may not use this file except in compliance
9#  with the License.  You may obtain a copy of the License at
10#
11#    http://www.apache.org/licenses/LICENSE-2.0
12#
13#  Unless required by applicable law or agreed to in writing,
14#  software distributed under the License is distributed on an
15#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16#  KIND, either express or implied.  See the License for the
17#  specific language governing permissions and limitations
18#  under the License.
19#
20#**************************************************************
21
22
23
24package installer::windows::selfreg;
25
26use installer::exiter;
27use installer::files;
28use installer::globals;
29use installer::worker;
30use installer::windows::idtglobal;
31
32##############################################################
33# Returning the cost for the selfreg table.
34##############################################################
35
36sub get_selfreg_cost
37{
38	my ( $onefile ) = @_;
39
40	return "0";
41}
42
43####################################################################################
44# Creating the file SelfReg.idt dynamically
45# Content:
46# File_ Cost
47# UpgradeCode VersionMin VersionMax Language Attributes Remove ActionProperty
48####################################################################################
49
50sub create_selfreg_table
51{
52	my ($filesref, $basedir) = @_;
53
54	my @selfregtable = ();
55
56	installer::windows::idtglobal::write_idt_header(\@selfregtable, "selfreg");
57
58	# Registering all libraries with flag "SELFREG"
59
60	my $selfregfiles = installer::worker::collect_all_items_with_special_flag($filesref, "SELFREG");
61
62	for ( my $i = 0; $i <= $#{$selfregfiles}; $i++ )
63	{
64		my $onefile = ${$selfregfiles}[$i];
65
66		my %selfreg = ();
67
68		$selfreg{'File_'} = $onefile->{'uniquename'};
69		$selfreg{'Cost'} = get_selfreg_cost($onefile);
70
71		my $oneline = $selfreg{'File_'} . "\t" . $selfreg{'Cost'} . "\n";
72
73		push(@selfregtable, $oneline);
74	}
75
76	# Saving the file
77
78	my $selfregtablename = $basedir . $installer::globals::separator . "SelfReg.idt";
79	installer::files::save_file($selfregtablename ,\@selfregtable);
80    $installer::logger::Lang->printf("Created idt file: %s\n", $selfregtablename);
81}
82
831;
84