my $interpolate = LITERAL_ENV;
my @active_lls = $class->active_paths;
- $path = $class->ensure_dir_structure_for($path);
+ $class->ensure_dir_structure_for($path);
+
+ # On Win32 directories often contain spaces. But some parts of the CPAN
+ # toolchain don't like that. To avoid this, GetShortPathName() gives us
+ # an alternate representation that has none.
+ # This only works if the directory already exists.
+ $path = Win32::GetShortPathName($path) if $^O eq 'MSWin32';
if (! $deactivating) {
if (@active_lls && $active_lls[-1] eq $path) {
warn "Attempting to create directory ${path}\n";
}
File::Path::mkpath($path);
- # Need to have the path exist to make a short name for it, so
- # converting to a short name here.
- $path = Win32::GetShortPathName($path) if $^O eq 'MSWin32';
-
- return $path;
+ return
}
sub guess_shelltype {
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;