Subject: [PATCH] Move Win32::* functions from win32/win32.c to ext/Win32/Win32.xs
Message-ID: <lc9kn2tb0p5sdd4q69rbc7067r4imar59r@4ax.com>
p4raw-id: //depot/perl@29509
);
sub MY::postamble {
- if ($^O =~ /MSWin32/ && Win32::IsWin95()) {
+ if ($^O =~ /MSWin32/ && !defined($ENV{SYSTEMROOT})) {
if ($Config{'make'} =~ /dmake/i) {
# dmake-specific
return <<'EOT';
}
sub _win32_cwd {
- $ENV{'PWD'} = Win32::GetCwd();
+ if (defined &DynaLoader::boot_DynaLoader) {
+ $ENV{'PWD'} = Win32::GetCwd();
+ }
+ else { # miniperl
+ chomp($ENV{'PWD'} = `cd`);
+ }
$ENV{'PWD'} =~ s:\\:/:g ;
return $ENV{'PWD'};
}
$Is{OS2} = $^O eq 'os2';
$Is{MacOS} = $^O eq 'MacOS';
if( $^O eq 'MSWin32' ) {
- Win32::IsWin95() ? $Is{Win95} = 1 : $Is{Win32} = 1;
+ if (defined &DynaLoader::boot_DynaLoader) {
+ Win32::IsWin95() ? $Is{Win95} = 1 : $Is{Win32} = 1;
+ }
+ else {
+ # Can't use Win32::* with miniperl
+ !(defined $ENV{SYSTEMROOT}) ? $Is{Win95} = 1 : $Is{Win32} = 1;
+ }
}
$Is{UWIN} = $^O =~ /^uwin(-nt)?$/;
$Is{Cygwin} = $^O eq 'cygwin';
use strict;
+# Cwd::cwd does an implicit "require Win32", but
+# the ../lib directory in @INC will no longer work once
+# we chdir() out of the "t" directory.
+use Win32;
+
use File::CheckTree;
use File::Spec; # used to get absolute paths
# preserve MPE file attributes.
return system('/bin/cp', '-f', $_[0], $_[1]) == 0;
};
- } elsif ($^O eq 'MSWin32') {
+ } elsif ($^O eq 'MSWin32' && defined &DynaLoader::boot_DynaLoader) {
+ # Win32::CopyFile() fill only work if we can load Win32.xs
*syscopy = sub {
return 0 unless @_ == 2;
return Win32::CopyFile(@_, 1);
########
$| = 1;
use Cwd;
+my $cwd = cwd(); # Make sure we load Win32.pm while "../lib" still works.
$\ = "\n";
my $dir;
if (fork) {
my %static;
sub getcwd {
- $ENV{'PWD'} = Win32::GetCwd();
- $ENV{'PWD'} =~ s:\\:/:g ;
- return $ENV{'PWD'};
+ $_ = `cd`;
+ chomp;
+ s:\\:/:g ;
+ return $ENV{'PWD'} = $_;
}
sub set_static_extensions
$opt{'version_patchlevel_string'} = "version $opt{PERL_VERSION} subversion $opt{PERL_SUBVERSION}";
$opt{'version_patchlevel_string'} .= " patchlevel $opt{PERL_PATCHLEVEL}" if exists $opt{PERL_PATCHLEVEL};
-$opt{'osvers'} = join '.', (Win32::GetOSVersion())[1,2];
+#$opt{'osvers'} = join '.', (Win32::GetOSVersion())[1,2];
+$opt{'osvers'} = "4.0";
if (exists $opt{cc}) {
# cl and bcc32 version detection borrowed from Test::Smoke's configsmoke.pl
$opt{incpath} = mungepath($opt{incpath}) if exists $opt{incpath};
# some functions are not available on Win9x
-if (defined(&Win32::IsWin95) && Win32::IsWin95()) {
+unless (defined $ENV{SYSTEMROOT}) { # SystemRoot has been introduced by WinNT
$opt{d_flock} = 'undef';
$opt{d_link} = 'undef';
}
BEGIN { $|= 1; print "1..267\n"; }
END {print "not ok 1\n" unless $loaded;}
+
+# Win32API::File does an implicit "require Win32", but
+# the ../lib directory in @INC will no longer work once
+# we chdir() into the TEMP directory.
+use Win32;
+
use Win32API::File qw(:ALL);
$loaded = 1;
print "ok 1\n";