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
;
21 use installer
::exiter
;
23 use installer
::globals
;
24 use installer
::windows
::idtglobal
;
26 ##############################################################
27 # Returning directory for createfolder table.
28 ##############################################################
30 sub get_createfolder_directory
34 my $uniquename = $onedir->{'uniquename'};
39 ##############################################################
40 # Searching the correct file for language pack directories.
41 ##############################################################
43 sub get_languagepack_file
45 my ($filesref, $onedir) = @_;
47 my $language = $onedir->{'specificlanguage'};
51 for ( my $i = 0; $i <= $#{$filesref}; $i++ )
53 $onefile = ${$filesref}[$i];
55 if ( $onefile->{'specificlanguage'} eq $onedir->{'specificlanguage'} )
62 if ( ! $foundfile ) { installer
::exiter
::exit_program
("ERROR: No file with correct language found (language pack build)!", "get_languagepack_file"); }
67 ##############################################################
68 # Returning component for createfolder table.
69 ##############################################################
71 sub get_createfolder_component
73 my ($onedir, $filesref, $allvariableshashref) = @_;
75 # Directories do not belong to a module.
76 # Therefore they can only belong to the root module and
77 # will be added to a component at the root module.
78 # All directories will be added to the component
79 # $allvariableshashref->{'ROOTMODULEGID'}
81 if ( ! $allvariableshashref->{'ROOTMODULEGID'} ) { installer
::exiter
::exit_program
("ERROR: ROOTMODULEGID must be defined in list file!", "get_createfolder_component"); }
83 my $rootmodulegid = $allvariableshashref->{'ROOTMODULEGID'};
86 if ( $installer::globals
::languagepack
) { $onefile = get_languagepack_file
($filesref, $onedir); }
87 elsif ( $installer::globals
::helppack
) { ($onefile) = grep {$_->{gid
} eq 'gid_File_Help_Common_Zip'} @
{$filesref} }
89 foreach my $file (@
{$filesref}) {
90 if ($file->{'modules'} eq $rootmodulegid)
98 if (! defined $onefile) {
99 installer
::exiter
::exit_program
("ERROR: Could not find file!", "get_createfolder_component");
102 return $onefile->{'componentname'};
105 ####################################################################################
106 # Creating the file CreateFo.idt dynamically for creation of empty directories
108 # Directory_ Component_
109 ####################################################################################
111 sub create_createfolder_table
113 my ($dirref, $filesref, $basedir, $allvariableshashref) = @_;
115 my @createfoldertable = ();
119 installer
::windows
::idtglobal
::write_idt_header
(\
@createfoldertable, "createfolder");
121 for ( my $i = 0; $i <= $#{$dirref}; $i++ )
123 my $onedir = ${$dirref}[$i];
125 # language packs and help packs get only language dependent directories
126 if (( $installer::globals
::languagepack
) || ( $installer::globals
::languagepack
) && ( $onedir->{'specificlanguage'} eq "" )) { next };
130 if ( $onedir->{'Styles'} ) { $styles = $onedir->{'Styles'}; }
132 if ( $styles =~ /\bCREATE\b/ )
136 $directory{'Directory_'} = get_createfolder_directory
($onedir);
137 $directory{'Component_'} = get_createfolder_component
($onedir, $filesref, $allvariableshashref);
139 my $oneline = $directory{'Directory_'} . "\t" . $directory{'Component_'} . "\n";
141 push(@createfoldertable, $oneline);
147 my $createfoldertablename = $basedir . $installer::globals
::separator
. "CreateFo.idt";
148 installer
::files
::save_file
($createfoldertablename ,\
@createfoldertable);
149 $infoline = "Created idt file: $createfoldertablename\n";
150 push(@installer::globals
::logfileinfo
, $infoline);