diff options
Diffstat (limited to 'Master/tlpkg/tlpostcode/haranoaji-tlpost.pl')
-rw-r--r-- | Master/tlpkg/tlpostcode/haranoaji-tlpost.pl | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/Master/tlpkg/tlpostcode/haranoaji-tlpost.pl b/Master/tlpkg/tlpostcode/haranoaji-tlpost.pl index 07cab2eed4e..90320bec1ee 100644 --- a/Master/tlpkg/tlpostcode/haranoaji-tlpost.pl +++ b/Master/tlpkg/tlpostcode/haranoaji-tlpost.pl @@ -38,14 +38,17 @@ use feature 'state'; use Encode; if (win32 ()) { + # These packages are not necessarily available on non-Windows, so + # read them at runtime instead of compile time. + require Encode::Locale; + Encode::Locale->import (); + + # ':encoding(console_{in|out})' requires Encode::Locale package. binmode (STDIN, ':encoding(console_in)'); binmode (STDOUT, ':encoding(console_out)'); binmode (STDERR, ':encoding(console_out)'); print "haranoaji-tlpost\n"; - - # These packages are not necessarily available on non-Windows, so - # read them at runtime instead of compile time. - require Encode::Locale; + require Win32::API; Win32::API->import (); } else { @@ -323,7 +326,7 @@ sub create_file_with_contents { my ($filename, $contents) = @_; # TODO: Create file by -W API on Windows - open (my $fh, ">:raw", encode ('locale', $filename)) or + open (my $fh, ">:raw", encode ('locale_fs', $filename)) or die ("Open failed: ${filename}\n"); print $fh $contents; close $fh; @@ -334,7 +337,7 @@ sub wrapper_isdir { my ($dirname) = @_; # TODO: Directory existence check by -W API on Windows - if ( -d encode ('locale', $dirname) ) { + if ( -d encode ('locale_fs', $dirname) ) { return 1; } @@ -346,7 +349,7 @@ sub wrapper_isfile { my ($filename) = @_; # TODO: File existence check by -W API on Windows - if ( -f encode ('locale', $filename) ) { + if ( -f encode ('locale_fs', $filename) ) { return 1; } @@ -358,7 +361,7 @@ sub wrapper_unlink { my ($filename) = @_; # TODO: Remove file by -W API on Windows - return unlink (encode ('locale', $filename)); + return unlink (encode ('locale_fs', $filename)); } # Create symbolic link |