xref: /trunk/main/solenv/bin/modules/installer/windows/binary.pm (revision 9780544fa6b4c85f7d9b48452f58c7da854fc9a5)
1*9780544fSAndrew Rist#**************************************************************
2cdf0e10cSrcweir#
3*9780544fSAndrew Rist#  Licensed to the Apache Software Foundation (ASF) under one
4*9780544fSAndrew Rist#  or more contributor license agreements.  See the NOTICE file
5*9780544fSAndrew Rist#  distributed with this work for additional information
6*9780544fSAndrew Rist#  regarding copyright ownership.  The ASF licenses this file
7*9780544fSAndrew Rist#  to you under the Apache License, Version 2.0 (the
8*9780544fSAndrew Rist#  "License"); you may not use this file except in compliance
9*9780544fSAndrew Rist#  with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir#
11*9780544fSAndrew Rist#    http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir#
13*9780544fSAndrew Rist#  Unless required by applicable law or agreed to in writing,
14*9780544fSAndrew Rist#  software distributed under the License is distributed on an
15*9780544fSAndrew Rist#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*9780544fSAndrew Rist#  KIND, either express or implied.  See the License for the
17*9780544fSAndrew Rist#  specific language governing permissions and limitations
18*9780544fSAndrew Rist#  under the License.
19cdf0e10cSrcweir#
20*9780544fSAndrew Rist#**************************************************************
21*9780544fSAndrew Rist
22*9780544fSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweirpackage installer::windows::binary;
25cdf0e10cSrcweir
26cdf0e10cSrcweiruse installer::existence;
27cdf0e10cSrcweiruse installer::files;
28cdf0e10cSrcweiruse installer::globals;
29cdf0e10cSrcweir
30cdf0e10cSrcweir###########################################################################################################
31cdf0e10cSrcweir# Updating the table Binary dynamically with all files from $binarytablefiles
32cdf0e10cSrcweir# Content:
33cdf0e10cSrcweir# Name  Data
34cdf0e10cSrcweir# s72   v0
35cdf0e10cSrcweir# Binary    Name
36cdf0e10cSrcweir###########################################################################################################
37cdf0e10cSrcweir
38cdf0e10cSrcweirsub update_binary_table
39cdf0e10cSrcweir{
40cdf0e10cSrcweir    my ($languageidtdir, $filesref, $binarytablefiles) = @_;
41cdf0e10cSrcweir
42cdf0e10cSrcweir    my $binaryidttablename = $languageidtdir . $installer::globals::separator . "Binary.idt";
43cdf0e10cSrcweir    my $binaryidttable = installer::files::read_file($binaryidttablename);
44cdf0e10cSrcweir
45cdf0e10cSrcweir    # Only the iconfiles, that are used in the shortcut table for the
46cdf0e10cSrcweir    # FolderItems (entries in Windows startmenu) are added into the icon table.
47cdf0e10cSrcweir
48cdf0e10cSrcweir    for ( my $i = 0; $i <= $#{$binarytablefiles}; $i++ )
49cdf0e10cSrcweir    {
50cdf0e10cSrcweir        my $binaryfile = ${$binarytablefiles}[$i];
51cdf0e10cSrcweir        my $binaryfilename = $binaryfile->{'Name'};
52cdf0e10cSrcweir        my $binaryfiledata = $binaryfilename;
53cdf0e10cSrcweir
54cdf0e10cSrcweir        $binaryfilename =~ s/\.//g;  # removing "." in filename: "abc.dll" to "abcdll" in name column
55cdf0e10cSrcweir
56cdf0e10cSrcweir        my %binary = ();
57cdf0e10cSrcweir
58cdf0e10cSrcweir        $binary{'Name'} = $binaryfilename;
59cdf0e10cSrcweir        $binary{'Data'} = $binaryfiledata;
60cdf0e10cSrcweir
61cdf0e10cSrcweir        my $oneline = $binary{'Name'} . "\t" . $binary{'Data'} . "\n";
62cdf0e10cSrcweir
63cdf0e10cSrcweir        push(@{$binaryidttable}, $oneline);
64cdf0e10cSrcweir    }
65cdf0e10cSrcweir
66cdf0e10cSrcweir    # Saving the file
67cdf0e10cSrcweir
68cdf0e10cSrcweir    installer::files::save_file($binaryidttablename ,$binaryidttable);
69cdf0e10cSrcweir    my $infoline = "Updated idt file: $binaryidttablename\n";
70cdf0e10cSrcweir    push(@installer::globals::logfileinfo, $infoline);
71cdf0e10cSrcweir}
72cdf0e10cSrcweir
73cdf0e10cSrcweir1;
74