Lines 902-946
Link Here
|
902 |
} |
902 |
} |
903 |
|
903 |
|
904 |
################################################################## |
904 |
################################################################## |
905 |
# Windows: Setting nsis version is necessary because of small |
|
|
906 |
# changes in nsis from version 2.0.4 to 2.3.1 |
907 |
################################################################## |
908 |
|
909 |
sub set_nsis_version |
910 |
{ |
911 |
my ($nshfile) = @_; |
912 |
|
913 |
my $searchstring = "\$\{LangFileString\}"; # occurs only in nsis 2.3.1 or similar |
914 |
|
915 |
for ( my $i = 0; $i <= $#{$nshfile}; $i++ ) |
916 |
{ |
917 |
if ( ${$nshfile}[$i] =~ /\Q$searchstring\E/ ) |
918 |
{ |
919 |
# this is nsis 2.3.1 or similar |
920 |
$installer::globals::nsis231 = 1; |
921 |
$installer::globals::unicodensis = 0; |
922 |
last; |
923 |
} |
924 |
} |
925 |
|
926 |
# checking unicode version |
927 |
$searchstring = convert_to_unicode($searchstring); |
928 |
|
929 |
for ( my $i = 0; $i <= $#{$nshfile}; $i++ ) |
930 |
{ |
931 |
if ( ${$nshfile}[$i] =~ /\Q$searchstring\E/ ) |
932 |
{ |
933 |
# this is nsis 2.3.1 or similar |
934 |
$installer::globals::nsis231 = 1; |
935 |
$installer::globals::unicodensis = 1; |
936 |
last; |
937 |
} |
938 |
} |
939 |
|
940 |
if ( ! $installer::globals::nsis231 ) { $installer::globals::nsis204 = 1; } |
941 |
} |
942 |
|
943 |
################################################################## |
944 |
# Windows: Including the product name into nsi template |
905 |
# Windows: Including the product name into nsi template |
945 |
################################################################## |
906 |
################################################################## |
946 |
|
907 |
|
Lines 1115-1123
Link Here
|
1115 |
if (length($locallangs) > $installer::globals::max_lang_length) { $locallangs = "multi lingual"; } |
1076 |
if (length($locallangs) > $installer::globals::max_lang_length) { $locallangs = "multi lingual"; } |
1116 |
|
1077 |
|
1117 |
if ( ! $installer::globals::languagepack ) { $productpath = $productpath . " (" . $locallangs . ")"; } |
1078 |
if ( ! $installer::globals::languagepack ) { $productpath = $productpath . " (" . $locallangs . ")"; } |
1118 |
|
1079 |
|
1119 |
# if (( $installer::globals::languagepack ) && ( $installer::globals::unicodensis )) { $productpath = convert_textstring_to_utf16($productpath, $localnsisdir, "stringhelper.txt"); } |
|
|
1120 |
|
1121 |
replace_one_variable($templatefile, "PRODUCTPATHPLACEHOLDER", $productpath); |
1080 |
replace_one_variable($templatefile, "PRODUCTPATHPLACEHOLDER", $productpath); |
1122 |
} |
1081 |
} |
1123 |
|
1082 |
|
Lines 1418-1429
Link Here
|
1418 |
sub replace_identifier_in_nshfile |
1377 |
sub replace_identifier_in_nshfile |
1419 |
{ |
1378 |
{ |
1420 |
my ( $nshfile, $identifier, $newstring, $nshfilename, $onelanguage ) = @_; |
1379 |
my ( $nshfile, $identifier, $newstring, $nshfilename, $onelanguage ) = @_; |
1421 |
|
|
|
1422 |
if ( $installer::globals::nsis231 ) |
1423 |
{ |
1424 |
$newstring =~ s/\\r/\$\\r/g; # \r -> $\r in modern nsis versions |
1425 |
$newstring =~ s/\\n/\$\\n/g; # \n -> $\n in modern nsis versions |
1426 |
} |
1427 |
|
1380 |
|
1428 |
for ( my $i = 0; $i <= $#{$nshfile}; $i++ ) |
1381 |
for ( my $i = 0; $i <= $#{$nshfile}; $i++ ) |
1429 |
{ |
1382 |
{ |
Lines 1616-1632
Link Here
|
1616 |
installer::systemactions::copy_one_file($sourcepath, $nshfilename); |
1569 |
installer::systemactions::copy_one_file($sourcepath, $nshfilename); |
1617 |
|
1570 |
|
1618 |
# Changing the macro name in nsh file: MUI_LANGUAGEFILE_BEGIN -> MUI_LANGUAGEFILE_PACK_BEGIN |
1571 |
# Changing the macro name in nsh file: MUI_LANGUAGEFILE_BEGIN -> MUI_LANGUAGEFILE_PACK_BEGIN |
1619 |
my $nshfile = installer::files::read_file($nshfilename); |
1572 |
convert_utf16_to_utf8($nshfilename); |
1620 |
set_nsis_version($nshfile); |
1573 |
convert_utf16_to_utf8($nlffilename); |
1621 |
|
1574 |
my $nshfile = installer::files::read_file($nshfilename); |
1622 |
if ( $installer::globals::unicodensis ) |
|
|
1623 |
{ |
1624 |
$installer::logger::Lang->printf("This is Unicode NSIS!\n"); |
1625 |
convert_utf16_to_utf8($nshfilename); |
1626 |
convert_utf16_to_utf8($nlffilename); |
1627 |
$nshfile = installer::files::read_file($nshfilename); # read nsh file again |
1628 |
} |
1629 |
|
1630 |
replace_one_variable($nshfile, "MUI_LANGUAGEFILE_BEGIN", "MUI_LANGUAGEFILE_PACK_BEGIN"); |
1575 |
replace_one_variable($nshfile, "MUI_LANGUAGEFILE_BEGIN", "MUI_LANGUAGEFILE_PACK_BEGIN"); |
1631 |
|
1576 |
|
1632 |
# find the ulf file for translation |
1577 |
# find the ulf file for translation |
Lines 1639-1649
Link Here
|
1639 |
installer::files::save_file($nshfilename, $nshfile); |
1584 |
installer::files::save_file($nshfilename, $nshfile); |
1640 |
installer::files::save_file($nlffilename, $nlffile); |
1585 |
installer::files::save_file($nlffilename, $nlffile); |
1641 |
|
1586 |
|
1642 |
if ( $installer::globals::unicodensis ) |
1587 |
convert_utf8_to_utf16($nshfilename); |
1643 |
{ |
1588 |
convert_utf8_to_utf16($nlffilename); |
1644 |
convert_utf8_to_utf16($nshfilename); |
|
|
1645 |
convert_utf8_to_utf16($nlffilename); |
1646 |
} |
1647 |
} |
1589 |
} |
1648 |
|
1590 |
|
1649 |
} |
1591 |
} |
Lines 1673-1710
Link Here
|
1673 |
} |
1615 |
} |
1674 |
|
1616 |
|
1675 |
################################################################## |
1617 |
################################################################## |
1676 |
# Windows: Only allow specific code for nsis 2.0.4 or nsis 2.3.1 |
|
|
1677 |
################################################################## |
1678 |
|
1679 |
sub put_version_specific_code_into_template |
1680 |
{ |
1681 |
my ($templatefile) = @_; |
1682 |
|
1683 |
my $subst204 = ""; |
1684 |
my $subst231 = ""; |
1685 |
|
1686 |
if ( $installer::globals::nsis204 ) |
1687 |
{ |
1688 |
$subst231 = ";"; |
1689 |
} |
1690 |
else |
1691 |
{ |
1692 |
$subst204 = ";"; |
1693 |
} |
1694 |
|
1695 |
replace_one_variable($templatefile, "\#204\#", $subst204); |
1696 |
replace_one_variable($templatefile, "\#231\#", $subst231); |
1697 |
} |
1698 |
|
1699 |
################################################################## |
1700 |
# Windows: Finding the path to the nsis SDK |
1618 |
# Windows: Finding the path to the nsis SDK |
1701 |
################################################################## |
1619 |
################################################################## |
1702 |
|
1620 |
|
1703 |
sub get_path_to_nsis_sdk |
1621 |
sub get_path_to_nsis_sdk |
1704 |
{ |
1622 |
{ |
1705 |
my $vol; |
|
|
1706 |
my $dir; |
1707 |
my $file; |
1708 |
my $nsispath = ""; |
1623 |
my $nsispath = ""; |
1709 |
|
1624 |
|
1710 |
if ( $ENV{'NSIS_PATH'} ) |
1625 |
if ( $ENV{'NSIS_PATH'} ) |
Lines 1711-1755
Link Here
|
1711 |
{ |
1626 |
{ |
1712 |
$nsispath = $ENV{'NSIS_PATH'}; |
1627 |
$nsispath = $ENV{'NSIS_PATH'}; |
1713 |
} |
1628 |
} |
1714 |
elsif ( $ENV{'SOLARROOT'} ) |
|
|
1715 |
{ |
1716 |
$nsispath = $ENV{'SOLARROOT'} . $installer::globals::separator . "NSIS"; |
1717 |
} |
1718 |
else |
1719 |
{ |
1720 |
# do we have nsis already in path ? |
1721 |
my @paths = split(/:/, $ENV{'PATH'}); |
1722 |
foreach my $path (@paths) |
1723 |
{ |
1724 |
$path =~ s/[\/\\]+$//; # remove trailing slashes; |
1725 |
$nsispath = $path . "/nsis"; |
1726 |
|
1727 |
if ( -x $nsispath ) |
1728 |
{ |
1729 |
$nsispath = $path; |
1730 |
last; |
1731 |
} |
1732 |
else |
1733 |
{ |
1734 |
$nsispath = ""; |
1735 |
} |
1736 |
} |
1737 |
} |
1738 |
if ( $ENV{'NSISSDK_SOURCE'} ) |
1739 |
{ |
1740 |
installer::logger::print_warning( "NSISSDK_SOURCE is deprecated. use NSIS_PATH instead.\n" ); |
1741 |
$nsispath = $ENV{'NSISSDK_SOURCE'}; # overriding the NSIS SDK with NSISSDK_SOURCE |
1742 |
} |
1743 |
|
1744 |
# if( ($^O =~ /cygwin/i) and $nsispath =~ /\\/ ) { |
1745 |
# # We need a POSIX path for W32-4nt-cygwin-perl |
1746 |
# $nsispath =~ s/\\/\\\\/g; |
1747 |
# chomp( $nsispath = qx{cygpath -u "$nsispath"} ); |
1748 |
# } |
1749 |
|
1750 |
if ( $nsispath eq "" ) |
1629 |
if ( $nsispath eq "" ) |
1751 |
{ |
1630 |
{ |
1752 |
$installer::logger::Info->print("... no Environment variable \"SOLARROOT\", \"NSIS_PATH\" or \"NSISSDK_SOURCE\" found and NSIS not found in path!\n"); |
1631 |
$installer::logger::Info->print("... no Environment variable \"NSIS_PATH\"!\n"); |
1753 |
} |
1632 |
} |
1754 |
elsif ( ! -d $nsispath ) |
1633 |
elsif ( ! -d $nsispath ) |
1755 |
{ |
1634 |
{ |
Lines 1840-1848
Link Here
|
1840 |
sub get_translation_file |
1719 |
sub get_translation_file |
1841 |
{ |
1720 |
{ |
1842 |
my ($allvariableshashref) = @_; |
1721 |
my ($allvariableshashref) = @_; |
1843 |
my $translationfilename = $installer::globals::idtlanguagepath . $installer::globals::separator . $installer::globals::nsisfilename; |
1722 |
my $translationfilename = $installer::globals::idtlanguagepath . $installer::globals::separator . $installer::globals::nsisfilename . ".uulf"; |
1844 |
if ( $installer::globals::unicodensis ) { $translationfilename = $translationfilename . ".uulf"; } |
|
|
1845 |
else { $translationfilename = $translationfilename . ".mlf"; } |
1846 |
if ( ! -f $translationfilename ) { installer::exiter::exit_program("ERROR: Could not find language file $translationfilename!", "get_translation_file"); } |
1723 |
if ( ! -f $translationfilename ) { installer::exiter::exit_program("ERROR: Could not find language file $translationfilename!", "get_translation_file"); } |
1847 |
my $translationfile = installer::files::read_file($translationfilename); |
1724 |
my $translationfile = installer::files::read_file($translationfilename); |
1848 |
replace_variables($translationfile, $allvariableshashref); |
1725 |
replace_variables($translationfile, $allvariableshashref); |
Lines 2078-2084
Link Here
|
2078 |
put_language_list_into_template($templatefile, $languagesarrayref); |
1955 |
put_language_list_into_template($templatefile, $languagesarrayref); |
2079 |
put_nsis_path_into_template($templatefile, $localnsisdir); |
1956 |
put_nsis_path_into_template($templatefile, $localnsisdir); |
2080 |
put_output_path_into_template($templatefile, $downloaddir); |
1957 |
put_output_path_into_template($templatefile, $downloaddir); |
2081 |
put_version_specific_code_into_template($templatefile); |
|
|
2082 |
|
1958 |
|
2083 |
my $nsifilename = save_script_file($localnsisdir, $templatefilename, $templatefile); |
1959 |
my $nsifilename = save_script_file($localnsisdir, $templatefilename, $templatefile); |
2084 |
|
1960 |
|