summaryrefslogtreecommitdiff
path: root/solenv/bin/modules/installer/windows/directory.pm
diff options
context:
space:
mode:
Diffstat (limited to 'solenv/bin/modules/installer/windows/directory.pm')
-rw-r--r--solenv/bin/modules/installer/windows/directory.pm107
1 files changed, 104 insertions, 3 deletions
diff --git a/solenv/bin/modules/installer/windows/directory.pm b/solenv/bin/modules/installer/windows/directory.pm
index ba6f9a3b75bd..f7b13747e3bf 100644
--- a/solenv/bin/modules/installer/windows/directory.pm
+++ b/solenv/bin/modules/installer/windows/directory.pm
@@ -77,19 +77,78 @@ sub overwrite_programfilesfolder
}
##############################################################
+# Maximum length of directory name is 72.
+# Taking care of underlines, which are the separator.
+##############################################################
+
+sub make_short_dir_version
+{
+ my ($longstring, $length, $displayname) = @_;
+
+ my $shortstring = "";
+ my $infoline = "";
+ my $savestring = $longstring;
+
+ # Splitting the string at each "underline" and allowing only $length characters per directory name.
+ # Checking also uniqueness and length.
+
+ my $stringarray = installer::converter::convert_stringlist_into_array_without_newline(\$longstring, "_");
+
+ foreach my $onestring ( @{$stringarray} )
+ {
+ my $partstring = "";
+
+ if ( $onestring =~ /\-/ )
+ {
+ my $localstringarray = installer::converter::convert_stringlist_into_array_without_newline(\$onestring, "-");
+ foreach my $onelocalstring ( @{$localstringarray} )
+ {
+ if ( length($onelocalstring) > $length ) { $onelocalstring = substr($onelocalstring, 0, $length); }
+ $partstring = $partstring . "-" . $onelocalstring;
+ }
+ $partstring =~ s/^\s*\-//;
+ }
+ else
+ {
+ if ( length($onestring) > $length ) { $partstring = substr($onestring, 0, $length); }
+ else { $partstring = $onestring; }
+ }
+
+ $shortstring = $shortstring . "_" . $partstring;
+ }
+
+ $shortstring =~ s/^\s*\_//;
+
+ if ( length($shortstring) > 72 )
+ {
+ my $shortlength = length($shortstring);
+ $infoline = "WARNING: Failed to create unique directory name with less than 72 characters: \"$displayname\" ($shortstring ($shortlength)).\n";
+ push(@installer::globals::logfileinfo, $infoline);
+ }
+
+ return $shortstring;
+}
+
+##############################################################
# Adding unique directory names to the directory collection
##############################################################
sub create_unique_directorynames
{
- my ($directoryref) = @_;
+ my ($directoryref, $allvariables) = @_;
$installer::globals::officeinstalldirectoryset = 0;
+ my %conversionhash = ();
+ my $infoline = "";
+ my $errorcount = 0;
+
for ( my $i = 0; $i <= $#{$directoryref}; $i++ )
{
my $onedir = ${$directoryref}[$i];
- my $uniquename = $onedir->{'HostName'};
+ my $hostname = $onedir->{'HostName'};
+
+ my $uniquename = $hostname;
my $styles = "";
if ( $onedir->{'Styles'} ) { $styles = $onedir->{'Styles'}; }
# get_path_from_fullqualifiedname(\$uniqueparentname);
@@ -101,6 +160,42 @@ sub create_unique_directorynames
$uniquename =~ s/\_//g; # removing existing underlines
$uniquename =~ s/\.//g; # removing dots in directoryname
$uniquename =~ s/\Q$installer::globals::separator\E/\_/g; # replacing slash and backslash with underline
+ $uniquename =~ s/OpenOffice/OO/g;
+ $uniquename =~ s/_registry/_rgy/g;
+ $uniquename =~ s/_registration/_rgn/g;
+ $uniquename =~ s/_extension/_ext/g;
+ $uniquename =~ s/_frame/_frm/g;
+ $uniquename =~ s/_table/_tbl/g;
+ $uniquename =~ s/_chart/_crt/g;
+
+ my $startlength = 5;
+
+ if ( ! $allvariables->{'NOSHORTDIRECTORYNAMES'} )
+ {
+ # This process does not work for SDK, because of its long and similar pathes
+ $uniquename = make_short_dir_version($uniquename, $startlength, $hostname); # taking care of underlines!
+ }
+
+ if ( exists($installer::globals::alluniquedirectorynames{$uniquename}) )
+ {
+ # This is an error, that must stop the packaging process
+ $errorcount++;
+
+ $infoline = "$errorcount: Already existing unique directory: $uniquename\n";
+ push( @installer::globals::logfileinfo, $infoline);
+ $infoline = "$errorcount: First full directory: $conversionhash{$uniquename}\n";
+ push( @installer::globals::logfileinfo, $infoline);
+ $infoline = "$errorcount: Current full directory: $hostname\n";
+ push( @installer::globals::logfileinfo, $infoline);
+ }
+
+ $conversionhash{$uniquename} = $hostname;
+
+ $installer::globals::alluniquedirectorynames{$uniquename} = 1;
+
+ # Important: The unique parent is generated from the string $uniquename. Therefore counters
+ # like adding "_1" is not allowed to achive uniqueness, because this depends from other directories
+ # and does not deliver always the same result.
my $uniqueparentname = $uniquename;
@@ -147,6 +242,11 @@ sub create_unique_directorynames
$installer::globals::vendordirectoryset = 1;
}
}
+
+ if ( $errorcount > 0 )
+ {
+ installer::exiter::exit_program("ERROR: Failed to create unique directory names.", "create_unique_directorynames");
+ }
}
#####################################################
@@ -434,8 +534,9 @@ sub create_directory_table
my $infoline;
overwrite_programfilesfolder($allvariableshashref);
- create_unique_directorynames($directoryref);
if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "directoriesforidt_local_1.log", $directoryref); }
+ create_unique_directorynames($directoryref, $allvariableshashref);
+ if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "directoriesforidt_local_1a.log", $directoryref); }
create_defaultdir_directorynames($directoryref, $shortdirnamehashref); # only destdir!
if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "directoriesforidt_local_2.log", $directoryref); }
set_installlocation_directory($directoryref, $allvariableshashref);