use local::lib ();
-my $dir1 = tempdir('test_local_lib-XXXXX', DIR => Cwd::abs_path('t'), CLEANUP => 1);
-$dir1 = local::lib->ensure_dir_structure_for($dir1);
-
-my $dir2 = tempdir('test_local_lib-XXXXX', DIR => Cwd::abs_path('t'), CLEANUP => 1);
-$dir2 = local::lib->ensure_dir_structure_for($dir2);
+sub mk_temp_dir
+{
+ my $name_template = shift;
+
+ my $path = tempdir($name_template, DIR => Cwd::abs_path('t'), CLEANUP => 1);
+ local::lib->ensure_dir_structure_for($path);
+ # On Win32 the path where the distribution is built usually contains
+ # spaces. This is a problem for some parts of the CPAN toolchain, so
+ # local::lib uses the GetShortPathName trick do get an alternate
+ # representation of the path that doesn't constain spaces.
+ return ($^O eq 'MSWin32')
+ ? Win32::GetShortPathName($path)
+ : $path
+}
+
+my $dir1 = mk_temp_dir('test_local_lib-XXXXX');
+my $dir2 = mk_temp_dir('test_local_lib-XXXXX');
my $prev_active = () = local::lib->active_paths;