blob: c73e3626d64b719a2838f7be80e23305fb321b21 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
#!/usr/bin/env perl
# For testing, edit $ro_dir and $wr_dir as needed.
# $ro_dir should be read-only.
# $wr_dir should be writable.
#!/usr/bin/env perl
use strict;
BEGIN {
$^W = 1;
my $me=$0;
$me=~s!\\!/!g if $^O=~/^MSWin(32|64)$/i;
if ($me=~m!/!) {
($::installerdir=$me)=~s!(.*)/.*$!$1!;
} else {
# This shouldn't occur if called from batchfile
$::installerdir='.';
}
unshift (@INC, "$::installerdir/tlpkg");
# unshift (@INC, "$::installerdir/bin/win32") if $^O=~/^MSWin(32|64)$/i;
}
use TeXLive::TLWinGoo; # safe under Unix/Linux!
my $ro_dir = "z:/aps";
sub maybenot {
my $bool = shift;
return $bool ? " is " : " is not ";
}
sub create_file {
my $name = shift;
return if -e $name;
open DUMMY, ">".$name;
print DUMMY "Hello";
close DUMMY;
}
sub print_search_paths {
print "System path: ".get_system_path()."\n";
print "User path: ".get_user_path()."\n";
}
print ((join "\n", @INC)."\n");
# admin
if (admin()) {
print "Admin or not on Windows\n";
} else {
print "Not admin\n";
}
# country
print "Country: " . reg_country() . "\n";
# global_tmpdir
print "Global tempdir: " . global_tmpdir()."\n";
if ($^O !~ /^MSWin(32|64)$/i) {
print "Not Windows; bailing out...\n";
exit;
}
# dir_writable
my $wr_dir = $ENV{'USERPROFILE'};
$wr_dir =~ s/\\/\//g;
mkdir $wr_dir unless -e $wr_dir;
print $wr_dir . maybenot(dir_writable($wr_dir)) . "writable\n";
print $ro_dir . maybenot(dir_writable($ro_dir)) . "writable\n";
# expand_string
print expand_string("pre\\%systemROOT%\\post")."\n";
# win_which_dir
print "cmd.exe found in " . TeXLive::TLWinGoo::win_which_dir("cmd.exe") . "\n";
# adding and removing texbindir
my $wr_dir1 = $wr_dir . "/tex1";
mkdir $wr_dir1 unless -e $wr_dir1;
create_file( $wr_dir1."/tex.exe" );
add_texbindir_to_path($wr_dir1);
print_search_paths();
print "tex.exe found in " .
TeXLive::TLWinGoo::win_which_dir("tex.exe") . "\n";
my $wr_dir2 = $wr_dir . "/tex2";
mkdir $wr_dir2 unless -e $wr_dir2;
create_file( $wr_dir2."/tex.exe" );
add_texbindir_to_path($wr_dir2);
print_search_paths();
print "tex.exe found in " .
TeXLive::TLWinGoo::win_which_dir("tex.exe") . "\n";
# the problem case: no admin, but TeX on system path
if (!admin()) {
my $fn = expand_string("%windir%")."/TEX.EXE";
$fn =~ s/\\/\//g;
create_file($fn); # a tex.exe on the system path!
add_texbindir_to_path(expand_string($wr_dir2));
my @wge = wg_error();
if (@wge) {
print $wge[1]."\n";
}
print_search_paths();
print "tex.exe found in " . TeXLive::TLWinGoo::win_which_dir("tex.exe") . "\n";
unlink $fn;
}
# adding a filetype
register_script_type(".rb","x:/ruby/bin/ruby.exe");
# broadcast environment changes
broadcast_env();
|