2 # This file is part of the LibreOffice project.
4 # This Source Code Form is subject to the terms of the Mozilla Public
5 # License, v. 2.0. If a copy of the MPL was not distributed with this
6 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 # This file incorporates work covered by the following license notice:
10 # Licensed to the Apache Software Foundation (ASF) under one or more
11 # contributor license agreements. See the NOTICE file distributed
12 # with this work for additional information regarding copyright
13 # ownership. The ASF licenses this file to you under the Apache
14 # License, Version 2.0 (the "License"); you may not use this file
15 # except in compliance with the License. You may obtain a copy of
16 # the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 package installer
::windows
::createfolder
;
24 use installer
::exiter
;
26 use installer
::globals
;
27 use installer
::windows
::idtglobal
;
29 ##############################################################
30 # Returning directory for createfolder table.
31 ##############################################################
33 sub get_createfolder_directory
37 my $uniquename = $onedir->{'uniquename'};
42 ##############################################################
43 # Searching the correct file for language pack directories.
44 ##############################################################
46 sub get_languagepack_file
48 my ($filesref, $onedir) = @_;
50 my $language = $onedir->{'specificlanguage'};
54 for ( my $i = 0; $i <= $#{$filesref}; $i++ )
56 $onefile = ${$filesref}[$i];
58 if ( $onefile->{'specificlanguage'} eq $onedir->{'specificlanguage'} )
65 if ( ! $foundfile ) { installer
::exiter
::exit_program
("ERROR: No file with correct language found (language pack build)!", "get_languagepack_file"); }
70 ##############################################################
71 # Returning component for createfolder table.
72 ##############################################################
74 sub get_createfolder_component
76 my ($onedir, $filesref, $allvariableshashref) = @_;
78 # Directories do not belong to a module.
79 # Therefore they can only belong to the root module and
80 # will be added to a component at the root module.
81 # All directories will be added to the component
82 # $allvariableshashref->{'ROOTMODULEGID'}
84 if ( ! $allvariableshashref->{'ROOTMODULEGID'} ) { installer
::exiter
::exit_program
("ERROR: ROOTMODULEGID must be defined in list file!", "get_createfolder_component"); }
86 my $rootmodulegid = $allvariableshashref->{'ROOTMODULEGID'};
89 if ( $installer::globals
::languagepack
) { $onefile = get_languagepack_file
($filesref, $onedir); }
90 elsif ( $installer::globals
::helppack
) { ($onefile) = grep {$_->{gid
} eq 'gid_File_Help_Common_Zip'} @
{$filesref} }
92 foreach my $file (@
{$filesref}) {
93 if ($file->{'modules'} eq $rootmodulegid)
101 if (! defined $onefile) {
102 installer
::exiter
::exit_program
("ERROR: Could not find file!", "get_createfolder_component");
105 return $onefile->{'componentname'};
108 ####################################################################################
109 # Creating the file CreateFo.idt dynamically for creation of empty directories
111 # Directory_ Component_
112 ####################################################################################
114 sub create_createfolder_table
116 my ($dirref, $filesref, $basedir, $allvariableshashref) = @_;
118 my @createfoldertable = ();
122 installer
::windows
::idtglobal
::write_idt_header
(\
@createfoldertable, "createfolder");
124 for ( my $i = 0; $i <= $#{$dirref}; $i++ )
126 my $onedir = ${$dirref}[$i];
128 # language packs and help packs get only language dependent directories
129 if (( $installer::globals
::languagepack
) || ( $installer::globals
::languagepack
) && ( $onedir->{'specificlanguage'} eq "" )) { next };
133 if ( $onedir->{'Styles'} ) { $styles = $onedir->{'Styles'}; }
135 if ( $styles =~ /\bCREATE\b/ )
139 $directory{'Directory_'} = get_createfolder_directory
($onedir);
140 $directory{'Component_'} = get_createfolder_component
($onedir, $filesref, $allvariableshashref);
142 my $oneline = $directory{'Directory_'} . "\t" . $directory{'Component_'} . "\n";
144 push(@createfoldertable, $oneline);
150 my $createfoldertablename = $basedir . $installer::globals
::separator
. "CreateFo.idt";
151 installer
::files
::save_file
($createfoldertablename ,\
@createfoldertable);
152 $infoline = "Created idt file: $createfoldertablename\n";
153 push(@installer::globals
::logfileinfo
, $infoline);