xref: /trunk/main/solenv/bin/modules/installer/windows/binary.pm (revision 1ecadb572e7010ff3b3382ad9bf179dbc6efadbb)
1#*************************************************************************
2#
3# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4#
5# Copyright 2000, 2010 Oracle and/or its affiliates.
6#
7# OpenOffice.org - a multi-platform office productivity suite
8#
9# This file is part of OpenOffice.org.
10#
11# OpenOffice.org is free software: you can redistribute it and/or modify
12# it under the terms of the GNU Lesser General Public License version 3
13# only, as published by the Free Software Foundation.
14#
15# OpenOffice.org is distributed in the hope that it will be useful,
16# but WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18# GNU Lesser General Public License version 3 for more details
19# (a copy is included in the LICENSE file that accompanied this code).
20#
21# You should have received a copy of the GNU Lesser General Public License
22# version 3 along with OpenOffice.org.  If not, see
23# <http://www.openoffice.org/license.html>
24# for a copy of the LGPLv3 License.
25#
26#*************************************************************************
27
28package installer::windows::binary;
29
30use installer::existence;
31use installer::files;
32use installer::globals;
33
34###########################################################################################################
35# Updating the table Binary dynamically with all files from $binarytablefiles
36# Content:
37# Name  Data
38# s72   v0
39# Binary    Name
40###########################################################################################################
41
42sub update_binary_table
43{
44    my ($languageidtdir, $filesref, $binarytablefiles) = @_;
45
46    my $binaryidttablename = $languageidtdir . $installer::globals::separator . "Binary.idt";
47    my $binaryidttable = installer::files::read_file($binaryidttablename);
48
49    # Only the iconfiles, that are used in the shortcut table for the
50    # FolderItems (entries in Windows startmenu) are added into the icon table.
51
52    for ( my $i = 0; $i <= $#{$binarytablefiles}; $i++ )
53    {
54        my $binaryfile = ${$binarytablefiles}[$i];
55        my $binaryfilename = $binaryfile->{'Name'};
56        my $binaryfiledata = $binaryfilename;
57
58        $binaryfilename =~ s/\.//g;  # removing "." in filename: "abc.dll" to "abcdll" in name column
59
60        my %binary = ();
61
62        $binary{'Name'} = $binaryfilename;
63        $binary{'Data'} = $binaryfiledata;
64
65        my $oneline = $binary{'Name'} . "\t" . $binary{'Data'} . "\n";
66
67        push(@{$binaryidttable}, $oneline);
68    }
69
70    # Saving the file
71
72    installer::files::save_file($binaryidttablename ,$binaryidttable);
73    my $infoline = "Updated idt file: $binaryidttablename\n";
74    push(@installer::globals::logfileinfo, $infoline);
75}
76
771;
78