summaryrefslogtreecommitdiff
path: root/Master/tlpkg/TeXLive/TLWinGoo.pm
diff options
context:
space:
mode:
authorSiep Kroonenberg <siepo@cybercomm.nl>2009-07-09 14:30:26 +0000
committerSiep Kroonenberg <siepo@cybercomm.nl>2009-07-09 14:30:26 +0000
commitc07ad5b552636262dc6117be24a440512f627bbf (patch)
treea0fad78dd09052a6b34b7d6f88ef0b694631664b /Master/tlpkg/TeXLive/TLWinGoo.pm
parent5d3f226c7fc8c2a869fd00630de22ad940a1820e (diff)
generic shell folder sub
git-svn-id: svn://tug.org/texlive/trunk@14205 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/TeXLive/TLWinGoo.pm')
-rw-r--r--Master/tlpkg/TeXLive/TLWinGoo.pm89
1 files changed, 57 insertions, 32 deletions
diff --git a/Master/tlpkg/TeXLive/TLWinGoo.pm b/Master/tlpkg/TeXLive/TLWinGoo.pm
index 1e71579ecec..d1f773f87d6 100644
--- a/Master/tlpkg/TeXLive/TLWinGoo.pm
+++ b/Master/tlpkg/TeXLive/TLWinGoo.pm
@@ -96,6 +96,7 @@ BEGIN {
&unregister_file_type
&broadcast_env
&update_assocs
+ &shell_folder
&desktop_path
&add_desktop_shortcut
&add_menu_shortcut
@@ -188,7 +189,7 @@ sub get_system_env {
if ($is_win) {
$is_admin = 0 if not get_system_env();
- debug("Configuring TLWinGoo for " .
+ debug("Configuring TLWinGoo for " .
($is_admin ? "admin" : "user") . "mode\n") if win32();
}
@@ -218,15 +219,15 @@ Currently only used for testing.
=cut
-sub non_admin {
+sub non_admin {
debug("TLWinGoo: switching to user mode\n");
- $is_admin = 0;
+ $is_admin = 0;
}
# just for testing; doesn't check actual user permissions
-sub admin_again {
+sub admin_again {
debug("TLWinGoo: switching to admin mode\n");
- $is_admin = 1;
+ $is_admin = 1;
}
=pod
@@ -454,7 +455,7 @@ sub unsetenv_reg {
Returns tex directories found on the search path.
A directory is a TeX directory if it contains tex.exe or
-pdftex.exe.
+pdftex.exe.
=cut
@@ -477,7 +478,7 @@ sub tex_dirs_on_path {
=item C<adjust_reg_path_for_texlive($action, $tlbindir, $mode)>
Edit system or user PATH variable in the registry.
-Adds or removes (depending on $action) $tlbindir directory
+Adds or removes (depending on $action) $tlbindir directory
to system or user PATH variable in the registry (depending on $mode).
=cut
@@ -840,45 +841,69 @@ sub short_name {
=over 4
-=item C<desktop_path>
+=item C<shell_folder>
-Location of desktop directory; if admin then the all users version,
-otherwise the user's personal version.
+Location of shell `special folders'; $user_name is the name
+to look for in user mode, $admin_name is the name for admin mode,
+e.g. `Desktop' and `Common Desktop'. The default for $admin_name is
+'Common .$user_name
=cut
-sub desktop_path() {
- my ($shell_key, $deskpath);
+sub shell_folder {
+ my ($user_name, $admin_name) = @_;
+ $admin_name = 'Common '.$user_name unless ($admin_name or !$user_name);
+ my ($shell_key, $sh_folder);
if (admin()) {
+ return 0 unless $admin_name;
$shell_key = $Registry->Open(
"LMachine/software/microsoft/windows/currentversion/explorer/shell folders/",
{Access => KEY_READ});
- $deskpath = short_name($shell_key -> {"/Common Desktop"});
+ $sh_folder = short_name($shell_key -> {"/$admin_name"});
} else {
$shell_key = $Registry->Open(
"CUser/software/microsoft/windows/currentversion/explorer/shell folders/",
{Access => KEY_READ});
- $deskpath = short_name($shell_key -> {"/Desktop"});
+ $sh_folder = short_name($shell_key -> {"/$user_name"});
}
- $deskpath =~ s!\\!/!g;
- return $deskpath;
+ $sh_folder =~ s!\\!/!g;
+ return $sh_folder;
+}
+
+sub desktop_path() {
+ return shell_folder('Desktop');
+ #my ($shell_key, $deskpath);
+ #if (admin()) {
+ # $shell_key = $Registry->Open(
+ # "LMachine/software/microsoft/windows/currentversion/explorer/shell folders/",
+ # {Access => KEY_READ});
+ # $deskpath = short_name($shell_key -> {"/Common Desktop"});
+ #} else {
+ # $shell_key = $Registry->Open(
+ # "CUser/software/microsoft/windows/currentversion/explorer/shell folders/",
+ # {Access => KEY_READ});
+ # $deskpath = short_name($shell_key -> {"/Desktop"});
+ #}
+ #$deskpath =~ s!\\!/!g;
+ #return $deskpath;
}
sub menu_path() {
- my ($shell_key, $menupath);
- if (admin()) {
- $shell_key = $Registry->Open(
- "LMachine/software/microsoft/windows/currentversion/explorer/shell folders/",
- {Access => KEY_READ});
- $menupath = short_name($shell_key -> {"/Common Programs"});
- } else {
- $shell_key = $Registry->Open(
- "CUser/software/microsoft/windows/currentversion/explorer/shell folders/",
- {Access => KEY_READ});
- $menupath = short_name($shell_key -> {"/Programs"});
- }
- $menupath =~ s!\\!/!g;
- return $menupath;
+ return shell_folder('Programs', 'Common Programs');
+ #my ($shell_key, $menupath);
+ #if (admin()) {
+ # $shell_key = $Registry->Open(
+ # "LMachine/software/microsoft/windows/currentversion/explorer/shell folders/",
+ # {Access => KEY_READ});
+ # $menupath = short_name($shell_key -> {"/Common Programs"});
+ #} else {
+ # $shell_key = $Registry->Open(
+ # "CUser/software/microsoft/windows/currentversion/explorer/shell folders/",
+ # {Access => KEY_READ});
+ # $menupath = short_name($shell_key -> {"/Programs"});
+ #}
+ #$menupath =~ s!\\!/!g;
+ #return $menupath;
}
=pod
@@ -946,14 +971,14 @@ sub add_menu_shortcut {
=item C<remove_desktop_shortcut($name)>
-For uninstallation of an individual package.
+For uninstallation of an individual package.
=cut
sub remove_desktop_shortcut {
my $name = shift;
unlink desktop_path().'/'.$name.'.lnk';
-}
+}
=pod