don't assume File::Path will be loaded in tests
[p5sagit/local-lib.git] / lib / local / lib.pm
index 1dcf471..8033d19 100644 (file)
@@ -208,7 +208,8 @@ sub setup_local_lib_for {
   my $interpolate = LITERAL_ENV;
   my @active_lls = $class->active_paths;
 
-  $class->ensure_dir_structure_for($path);
+  $class->ensure_dir_structure_for($path)
+    unless $deactivating;
 
   # On Win32 directories often contain spaces. But some parts of the CPAN
   # toolchain don't like that. To avoid this, GetShortPathName() gives us
@@ -362,9 +363,9 @@ sub setup_env_hash_for {
 sub build_environment_vars_for {
   my ($class, $path, $deactivating, $interpolate) = @_;
 
-  if ($deactivating == DEACTIVATE_ONE) {
+  if ($deactivating && $deactivating == DEACTIVATE_ONE) {
     return $class->build_deactivate_environment_vars_for($path, $interpolate);
-  } elsif ($deactivating == DEACTIVATE_ALL) {
+  } elsif ($deactivating && $deactivating == DEACTIVATE_ALL) {
     return $class->build_deact_all_environment_vars_for($path, $interpolate);
   } else {
     return $class->build_activate_environment_vars_for($path, $interpolate);