From 53b5a75f168eb0b9dd6bce26d95a191700aff536 Mon Sep 17 00:00:00 2001 From: Siep Kroonenberg Date: Wed, 29 Oct 2008 22:52:53 +0000 Subject: TLWinGoo: for shortcuts, use short names of desktop and start/programs directory names git-svn-id: svn://tug.org/texlive/trunk@11117 c570f23f-e606-0410-a88d-b1316a301751 --- Master/tlpkg/TeXLive/TLWinGoo.pm | 55 ++++++++++++++++++++++++++++++---------- 1 file changed, 42 insertions(+), 13 deletions(-) (limited to 'Master') diff --git a/Master/tlpkg/TeXLive/TLWinGoo.pm b/Master/tlpkg/TeXLive/TLWinGoo.pm index 3fd5bd92d9d..36dd010f63f 100644 --- a/Master/tlpkg/TeXLive/TLWinGoo.pm +++ b/Master/tlpkg/TeXLive/TLWinGoo.pm @@ -53,6 +53,7 @@ C -- Additional utilities for Windows =head2 SHORTCUTS + TeXLive::TLWinGoo::desktop_path; TeXLive::TLWinGoo::add_desktop_shortcut($texdir, $name, $icon, $prog, $args, $batgui); TeXLive::TLWinGoo::add_menu_shortcut($place, $name, $icon, @@ -98,6 +99,7 @@ BEGIN { &unregister_file_type &broadcast_env &update_assocs + &desktop_path &add_desktop_shortcut &add_menu_shortcut &remove_desktop_shortcut @@ -105,7 +107,6 @@ BEGIN { &init_unshortbat &create_uninstaller &unregister_uninstaller - &desktop_path ); # for testing also: @EXPORT_OK = qw( @@ -114,6 +115,7 @@ BEGIN { &get_user_env &win_which_dir &global_tmpdir + &is_a_texdir ); if ($^O=~/^MSWin(32|64)$/i) { require Win32::API; @@ -260,8 +262,6 @@ sub reg_country { =head2 ENVIRONMENT AND REGISTRY -=over 4 - Most settings can be made for a user and for the system. User settings override system settings. @@ -277,6 +277,8 @@ settings with them to other systems, not system settings. In this case, with a TeXLive on the network, a nonadmin install makes the most sense. +=over 4 + =item C This function replaces substrings C<%env_var%> with their current @@ -787,22 +789,51 @@ sub update_assocs() { =pod +=back + =head2 SHORTCUTS =cut +# short path names + +my $shortfu; +if ($^O=~/^MSWin(32|64)$/i) { + $shortfu = new Win32::API('kernel32', 'GetShortPathName', 'PPN', 'N'); +} + +sub short_name { + my ($fname) = @_; + return $fname unless $is_win; + my $buffer = (' ' x 260); + my $slength = $shortfu->Call($fname, $buffer, 260); + if ($slength>0) { return substr $buffer, 0, $slength; } + else { return ''; } +} + +=pod + +=over 4 + +=item C + +Location of desktop directory; if admin then the all users version, +otherwise the user's personal version. + +=cut + sub desktop_path() { my ($shell_key, $deskpath); if (admin()) { $shell_key = $Registry->Open( "LMachine/software/microsoft/windows/currentversion/explorer/shell folders/", {Access => KEY_READ}); - $deskpath = $shell_key -> {"/Common Desktop"}; + $deskpath = short_name($shell_key -> {"/Common Desktop"}); } else { $shell_key = $Registry->Open( "CUser/software/microsoft/windows/currentversion/explorer/shell folders/", {Access => KEY_READ}); - $deskpath = $shell_key -> {"/Desktop"}; + $deskpath = short_name($shell_key -> {"/Desktop"}); } $deskpath =~ s!\\!/!g; return $deskpath; @@ -814,12 +845,12 @@ sub menu_path() { $shell_key = $Registry->Open( "LMachine/software/microsoft/windows/currentversion/explorer/shell folders/", {Access => KEY_READ}); - $menupath = $shell_key -> {"/Common Programs"}; + $menupath = short_name($shell_key -> {"/Common Programs"}); } else { $shell_key = $Registry->Open( "CUser/software/microsoft/windows/currentversion/explorer/shell folders/", {Access => KEY_READ}); - $menupath = $shell_key -> {"/Programs"}; + $menupath = short_name($shell_key -> {"/Programs"}); } $menupath =~ s!\\!/!g; return $menupath; @@ -865,8 +896,6 @@ sub add_desktop_shortcut { } } -=cut - =pod =item C @@ -940,8 +967,6 @@ sub remove_desktop_shortcut { unlink desktop_path().'/'.$name.'.lnk'; } -=cut - =pod =item C @@ -960,8 +985,12 @@ sub remove_menu_shortcut { =pod +=back + =head2 UNINSTALLER +=over 4 + =item C Writes registry entries for add/remove programs which reference -- cgit v1.2.3