diff options
Diffstat (limited to 'Master')
-rw-r--r-- | Master/tlpkg/TeXLive/TLUtils.pm | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm index 0051bc91ff6..40f47ac6950 100644 --- a/Master/tlpkg/TeXLive/TLUtils.pm +++ b/Master/tlpkg/TeXLive/TLUtils.pm @@ -526,23 +526,13 @@ Return C<$path> with its trailing C</component> removed. sub dirname { my $path=shift; - my $drive=''; - if (&win32) { + if (win32) { $path=~s!\\!/!g; } - if ($path=~m!^[A-Za-z]\:!) { - $path=~ s/^(.\:)(.*)/$1,$2/; - ($drive, $path)=($1,$2); - } - if ($path=~m!/!) { - $path=~m!(.*)/.*!; # works because of greedy matching - my $dir=$1; - if (length($dir)) { # dirname("foo/bar/baz") -> "foo/bar" - return "$drive$dir"; - } else { # dirname("/baz") -> "/" - return "$drive/"; - } - } else { # dirname("ignore") -> "." + if ($path=~m!/!) { # dirname("foo/bar/baz") -> "foo/bar" + $path=~m!(.*)/.*!; # works because of greedy matching + return $1; + } else { # dirname("ignore") -> "." return "."; } } |