8 unless (defined &Win32::BuildNumber && Win32::BuildNumber() >= 820 or $] >= 5.008009) {
9 print "1..0 # Skip: Needs ActivePerl 820 or Perl 5.8.9 or later\n";
12 unless ((Win32::FsType())[1] & 4) {
13 print "1..0 # Skip: Filesystem doesn't support Unicode\n";
16 unless ((Win32::GetOSVersion())[1] > 4) {
17 print "1..0 # Skip: Unicode support requires Windows 2000 or later\n";
22 my $home = Win32::GetCwd();
23 my $dir = "Foo \x{394}\x{419} Bar \x{5E7}\x{645} Baz";
24 my $file = "$dir\\xyzzy \x{394}\x{419} plugh \x{5E7}\x{645}";
28 my $ansi = Win32::GetANSIPathName($file);
29 unlink($ansi) if -f $ansi;
30 $ansi = Win32::GetANSIPathName($dir);
31 rmdir($ansi) if -d $ansi;
39 # Create Unicode directory
40 Win32::CreateDirectory($dir);
41 ok(-d Win32::GetANSIPathName($dir));
44 Win32::CreateFile($file);
45 ok(-f Win32::GetANSIPathName($file));
47 # readdir() returns ANSI form of Unicode filename
48 ok(opendir(my $dh, Win32::GetANSIPathName($dir)));
49 while ($_ = readdir($dh)) {
51 ok($file, Win32::GetLongPathName("$dir\\$_"));
55 # Win32::GetLongPathName() of the absolute path restores the Unicode dir name
56 my $full = Win32::GetFullPathName($dir);
57 my $long = Win32::GetLongPathName($full);
59 ok($long, Win32::GetLongPathName($home)."\\$dir");
61 # We can Win32::SetCwd() into the Unicode directory
62 ok(Win32::SetCwd($dir));
63 ok(Win32::GetLongPathName(Win32::GetCwd()), $long);
65 # cwd() also returns a usable ANSI directory name
66 (my $cwd = cwd) =~ s,/,\\,g;
67 ok(Win32::GetLongPathName($cwd), $long);
69 # change back to home directory
71 ok(Win32::GetCwd(), $home);
73 # We can chdir() into the Unicode directory if we use the ANSI name
74 ok(chdir(Win32::GetANSIPathName($dir)));
75 ok(Win32::GetLongPathName(Win32::GetCwd()), $long);