summaryrefslogtreecommitdiff
path: root/Master/tlpkg/TeXLive/TLWinGoo.pm
diff options
context:
space:
mode:
authorSiep Kroonenberg <siepo@cybercomm.nl>2008-01-13 12:30:29 +0000
committerSiep Kroonenberg <siepo@cybercomm.nl>2008-01-13 12:30:29 +0000
commit26c58e8a4f8469a61092b4943e604dfaa58d2742 (patch)
tree973be7c4c25229a551f7ed56787ba6c041080fcb /Master/tlpkg/TeXLive/TLWinGoo.pm
parentd75011acae11da0327fbaf71cd13b29c433c7df6 (diff)
Updated install-tl.pl to make use of TLWinGoo. Moved Norberts file
type code to TLWinGoo. It now only affects HKCU for non-admin users. wingoo-demo.pl now also tests the file type code. Commented out $ENV{'PERL5LIB'}=undef; in install-tl.pl l. 28 since it is unnecessary and generates an undefined scalar value error. git-svn-id: svn://tug.org/texlive/trunk@6209 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/TeXLive/TLWinGoo.pm')
-rw-r--r--Master/tlpkg/TeXLive/TLWinGoo.pm50
1 files changed, 45 insertions, 5 deletions
diff --git a/Master/tlpkg/TeXLive/TLWinGoo.pm b/Master/tlpkg/TeXLive/TLWinGoo.pm
index 3629d49007c..0a5bbba2908 100644
--- a/Master/tlpkg/TeXLive/TLWinGoo.pm
+++ b/Master/tlpkg/TeXLive/TLWinGoo.pm
@@ -1,7 +1,7 @@
# TeXLive::TLWinGoo.pm
# Windows nastiness
#
-# Copyright 2007 Siep Kroonenberg
+# Copyright 2008 Siep Kroonenberg, Norbert Preining
# This file is licensed under the GNU General Public License version 2
# or any later version.
@@ -25,6 +25,7 @@ C<TeXLive::TLWinGoo> -- Additional utilities for Windows
TeXLive::TLWinGoo::get_user_path;
TeXLive::TLWinGoo::win_which_dir($prog);
TeXLive::TLWinGoo::add_texbindir_to_path($texpath);
+ TeXLive::TLWinGoo::register_script_type($extension, $command);
=head2 DESCRIPTION
@@ -45,6 +46,7 @@ BEGIN {
&get_user_path
&win_which_dir
&add_texbindir_to_path
+ &register_script_type
);
if ($^O=~/^MSWin(32|64)$/i) {
@@ -189,7 +191,6 @@ forward slashes.
=cut
sub get_system_path {
- $Registry->ArrayValues(0);
my $value = get_system_env() -> {'/Path'};
$value =~ s/\\/\//g;
$value =~ s/[\s\x00]+$//;
@@ -207,7 +208,6 @@ expandable.
=cut
sub get_user_path {
- $Registry->ArrayValues(0);
my $value = get_user_env() -> {'/Path'};
return "" if not $value;
$value =~ s/\\/\//g;
@@ -264,8 +264,6 @@ path. A directory is a TeX directory if it contains tex.exe or
pdftex.exe. Then add desired TeX directory; to system path if
admin, otherwise to user path.
-=back
-
=cut
sub add_texbindir_to_path {
@@ -306,9 +304,51 @@ sub add_texbindir_to_path {
}
}
+=pod
+
+=item C<register_script_type>
+Add registry entries to associate $extension with $command and make
+$extension an executable file type. Slashes are flipped where necessary.
+
+=back
+
+=cut
+sub register_script_type {
+ my $extension = shift;
+ $extension = '.'.$extension unless $extension =~ /^\./; # ensure leading dot
+ $extension = uc($extension);
+ my $command = shift;
+ $command =~s/\//\\/g;
+ # pathext
+
+ my $pathext = get_user_env() -> {'/PATHEXT'};
+ $pathext = get_system_env() -> {'/PATHEXT'} if not $pathext;
+ my $found = 0;
+ foreach my $e (split(/;/,$pathext)) {
+ $found = 1 if (uc($e) eq $extension);
+ }
+ if (!$found) {
+ if ($is_admin) {
+ (get_system_env() -> {"/PATHEXT"}) = $pathext.";".$extension;
+ } else {
+ (get_user_env() -> {"/PATHEXT"}) = $pathext.";".$extension;
+ }
+ }
+
+ # file type
+
+ $extension = lc($extension);
+ my $classes_key = $Registry -> Open(
+ ($is_admin ? "LMachine/Software/Classes/" : "CUser/Software/Classes/"),
+ {Access => KEY_ALL_ACCESS()}) or die "Cannot open classpath";
+ $classes_key->ArrayValues(0);
+ $classes_key->CreateKey($extension)->SetValue("","script".$extension);
+ $classes_key->CreateKey("script".$extension."/Shell/Open/Command/")->
+ SetValue("", $command.' "%1" %*');
+}
# needs a terminal 1 for require to succeed!
1;