| 1 | package ExtUtils::Helpers::Windows; | ||
| 2 | $ExtUtils::Helpers::Windows::VERSION = '0.026'; | ||
| 3 | use strict; | ||
| 4 | use warnings FATAL => 'all'; | ||
| 5 | |||
| 6 | use Exporter 5.57 'import'; | ||
| 7 | our @EXPORT = qw/make_executable detildefy/; | ||
| 8 | |||
| 9 | use Config; | ||
| 10 | use Carp qw/carp croak/; | ||
| 11 | use ExtUtils::PL2Bat 'pl2bat'; | ||
| 12 | |||
| 13 | sub make_executable { | ||
| 14 | my $script = shift; | ||
| 15 | if (-T $script && $script !~ / \. (?:bat|cmd) $ /x) { | ||
| 16 | pl2bat(in => $script, update => 1); | ||
| 17 | } | ||
| 18 | return; | ||
| 19 | } | ||
| 20 | |||
| 21 | sub detildefy { | ||
| 22 | my $value = shift; | ||
| 23 | $value =~ s{ ^ ~ (?= [/\\] | $ ) }[$ENV{USERPROFILE}]x if $ENV{USERPROFILE}; | ||
| 24 | return $value; | ||
| 25 | } | ||
| 26 | |||
| 27 | 1; | ||
| 28 | |||
| 29 | # ABSTRACT: Windows specific helper bits | ||
| 30 | |||
| 31 | __END__ |