From b7efa0d4f4b4ecf5e8eb51d5aded4b7c4df58dd6 Mon Sep 17 00:00:00 2001 From: Manuel Pégourié-Gonnard Date: Mon, 5 Jul 2010 16:50:36 +0000 Subject: Adjustments to path display functions. git-svn-id: svn://tug.org/texlive/trunk@19247 c570f23f-e606-0410-a88d-b1316a301751 --- Master/install-tl | 2 +- Master/tlpkg/TeXLive/TLUtils.pm | 26 ++++++++++++++++++++++++++ Master/tlpkg/installer/install-menu-perltk.pl | 15 +-------------- Master/tlpkg/installer/install-menu-wizard.pl | 14 +------------- 4 files changed, 29 insertions(+), 28 deletions(-) (limited to 'Master') diff --git a/Master/install-tl b/Master/install-tl index 6a0b83d3857..e6f2cb3a50a 100755 --- a/Master/install-tl +++ b/Master/install-tl @@ -54,7 +54,7 @@ use TeXLive::TLUtils qw(platform platform_desc which getenv win32 unix info log debug tlwarn ddebug tldie get_system_tmpdir member process_logging_options rmtree mkdirhier make_var_skeleton make_local_skeleton install_package copy - install_packages dirname setup_programs); + install_packages dirname setup_programs native_slashify forward_slashify); #use TeXLive::TLMedia; use TeXLive::TLPOBJ; use TeXLive::TLPDB; diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm index 525ee61430c..95f9fd3268a 100644 --- a/Master/tlpkg/TeXLive/TLUtils.pm +++ b/Master/tlpkg/TeXLive/TLUtils.pm @@ -89,6 +89,8 @@ C -- utilities used in the TeX Live infrastructure TeXLive::TLUtils::merge_into(\%to, \%from); TeXLive::TLUtils::texdir_check($texdir); TeXLive::TLUtils::conv_to_w32_path($path); + TeXLive::TLUtils::native_slashify($internal_path); + TeXLive::TLUtils::forward_slashify($path_from_user); TeXLive::TLUtils::give_ctan_mirror(); TeXLive::TLUtils::give_ctan_mirror_base(); TeXLive::TLUtils::tlmd5($path); @@ -139,6 +141,9 @@ BEGIN { &member "ewords &conv_to_w32_path + &native_slashify + &forward_slashify + &conv_to_w32_path &untar &merge_into &give_ctan_mirror @@ -3075,6 +3080,27 @@ sub conv_to_w32_path { return($p); } +=pod + +The next two functions are meant for user input/output in installer menus. +They help making the windows user happy by turning slashes into backslashes +before displaying a path, and our code happy by turning backslashes into forwars +slashes after reading a path. They both are no-ops on Unix. + +=cut + +sub native_slashify { + my ($r) = @_; + $r =~ s!/!\\!g if win32(); + return $r; +} + +sub forward_slashify { + my ($r) = @_; + $r =~ s!\\!/!g if win32(); + return $r; +} + =item C Set up to use persistent connections using LWP/TLDownload. diff --git a/Master/tlpkg/installer/install-menu-perltk.pl b/Master/tlpkg/installer/install-menu-perltk.pl index 008190880fc..bc2f9d586e3 100644 --- a/Master/tlpkg/installer/install-menu-perltk.pl +++ b/Master/tlpkg/installer/install-menu-perltk.pl @@ -90,19 +90,6 @@ $::run_menu = \&run_menu_perltk; # ################################################################## -sub native_slashify { - my ($r) = @_; - $r =~ s/\//\\/g if win32(); - return $r; -} - -sub forward_slashify { - my ($r) = @_; - $r =~ s/\\/\//g if win32(); - return $r; -} - - sub setup_hooks_perltk { @::info_hook = (); push @::info_hook, @@ -481,7 +468,7 @@ sub menu_edit_vars_value { $hint_var = win32() ? '%USERPROFILE%' : '$HOME'; } $sw->Label(-text => __("Enter path for %s (use ~ for %s)", $key, $hint_var))->pack(-padx => "2m", -pady => "2m"); - my $entry = $sw->Entry(-textvariable => native_slashify($val), -width => 60); + my $entry = $sw->Entry(-text => native_slashify($val), -width => 60); $entry->pack(-padx => "2m", -pady => "2m")->focus(); my $f = $sw->Frame; my $okbutton = $f->Button(-text => __("Ok"), diff --git a/Master/tlpkg/installer/install-menu-wizard.pl b/Master/tlpkg/installer/install-menu-wizard.pl index 3626047b38f..38eb81a7dbc 100644 --- a/Master/tlpkg/installer/install-menu-wizard.pl +++ b/Master/tlpkg/installer/install-menu-wizard.pl @@ -92,18 +92,6 @@ $::run_menu = \&run_menu_wizard; # From here on only function definitions # #################################################################### -sub native_slashify { - my ($r) = @_; - $r =~ s/\//\\/g if win32(); - return $r; -} - -sub forward_slashify { - my ($r) = @_; - $r =~ s/\\/\//g if win32(); - return $r; -} - sub setup_hooks_wizard { @::info_hook = (); push @::info_hook, @@ -287,7 +275,7 @@ sub change_path { $sw->transient($mw); $sw->grab(); $sw->Label(-text => __('Enter path for') . " TEXDIR: ")->pack(-padx => "2m", -pady => "2m"); - my $entry = $sw->Entry(-textvariable => native_slashify($val), -width => 60); + my $entry = $sw->Entry(-text => native_slashify($val), -width => 60); $entry->pack(-padx => "2m", -pady => "2m")->focus(); my $f = $sw->Frame; my $okbutton = $f->Button(-text => __('Ok'), -width => 10, -- cgit v1.2.3