normalize path whenever possible, not only on activate
[p5sagit/local-lib.git] / lib / local / lib.pm
index 10e7cad..9d7d69e 100644 (file)
@@ -181,6 +181,7 @@ sub deactivate {
   my ($self, $path) = @_;
   $self = $self->new unless ref $self;
   $path = $self->resolve_path($path);
+  $path = $self->normalize_path($path);
 
   my @active_lls = $self->active_paths;
 
@@ -232,8 +233,7 @@ sub activate {
   $self->ensure_dir_structure_for($path)
     unless $self->no_create;
 
-  $path = ( Win32::GetShortPathName($path) || $path )
-    if $^O eq 'MSWin32';
+  $path = $self->normalize_path($path);
 
   my @active_lls = $self->active_paths;
 
@@ -256,6 +256,13 @@ sub activate {
   $self->clone(%args);
 }
 
+sub normalize_path {
+  my ($self, $path) = @_;
+  $path = ( Win32::GetShortPathName($path) || $path )
+    if $^O eq 'MSWin32';
+  return $path;
+}
+
 sub _legacy {
   my ($self, $path) = @_;
   $self = $self->new unless ref $self;
@@ -577,12 +584,12 @@ sub guess_shelltype {
 
   for ($shellbin) {
     return
-        /csh/             ? 'csh'
-      : /command\.com/    ? 'cmd'
-      : /cmd\.exe/        ? 'cmd'
-      : /4nt\.exe/        ? 'cmd'
-      : /powershell\.exe/ ? 'powershell'
-                          : 'bourne';
+        /csh/              ? 'csh'
+      : /command\.com/i    ? 'cmd'
+      : /cmd\.exe/i        ? 'cmd'
+      : /4nt\.exe/i        ? 'cmd'
+      : /powershell\.exe/i ? 'powershell'
+                           : 'bourne';
   }
 }