[Jifty-commit] r4217 - in jifty/trunk: lib/Jifty

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Tue Oct 9 17:42:31 EDT 2007


Author: sartak
Date: Tue Oct  9 17:42:30 2007
New Revision: 4217

Modified:
   jifty/trunk/   (props changed)
   jifty/trunk/lib/Jifty/Util.pm

Log:
 r43559 at onn:  sartak | 2007-10-09 17:21:52 -0400
 Add Jifty::Util->is_app_root to determine whether a path looks enough like the app root


Modified: jifty/trunk/lib/Jifty/Util.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Util.pm	(original)
+++ jifty/trunk/lib/Jifty/Util.pm	Tue Oct  9 17:42:30 2007
@@ -174,6 +174,25 @@
     return ''; # returning undef causes tons of 'uninitialized...' warnings.
 }
 
+=head2 is_app_root PATH
+
+Returns a boolean indicating whether the path passed in is the same path as
+the app root. Useful if you're recursing up a directory tree and want to
+stop when you've hit the root. It does not attempt to handle symbolic links.
+
+=cut
+
+sub is_app_root
+{
+    my $self = shift;
+    my $path = shift;
+    my $app_root = $self->app_root;
+
+    my $rel = File::Spec->abs2rel( $path, $app_root );
+
+    return $rel eq File::Spec->curdir;
+}
+
 =head2 default_app_name
 
 Returns the default name of the application.  This is the name of the


More information about the Jifty-commit mailing list