Prettify home path by resolving '..' (Andy Grundman)
Christian Hansen [Tue, 7 Jun 2005 04:05:11 +0000 (04:05 +0000)]
Changes
lib/Catalyst/Utils.pm

diff --git a/Changes b/Changes
index 6cc886a..248e808 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,6 +1,7 @@
 This file documents the revision history for Perl extension Catalyst.
 
 5.24  2005-06-03 02:30:00
+        - Prettify home path by resolving '..' (Andy Grundman)
 
 5.23  2005-06-03 02:30:00
         - added support for non Catalyst::Base components to live in namespace
index 325e723..8b3dc2e 100644 (file)
@@ -119,6 +119,12 @@ sub home {
         {
             $home = $subdir;
         }
+        # clean up relative path:
+        # MyApp/script/.. -> MyApp
+        my ($lastdir) = $home->dir_list( -1, 1 );
+        if ( $lastdir eq '..' ) {
+            $home = dir($home)->parent->parent;
+        }
     }
     return $home;
 }