Commits

Anonymous committed 03eb062

Put all the ::PathComp's in the _dir_stack.

- Refactoring - made the first ::PathTop component the first element
in _dir_stack() so we won't need to keep in a distinct reference. All
the other elements moved 1 level down the stack.

Comments (0)

Files changed (2)

     a lot there anymore.
     - Refactoring - renamed ::PathComponent as ::DeepPath and ::PathTop
     as ::TopPath. Otherwise they could be confused with ::PathComp.
+    - Refactoring - made the first ::PathTop component the first element
+    in _dir_stack() so we won't need to keep in a distinct reference. All
+    the other elements moved 1 level down the stack.
 
 0.1.5 - Sat Jan  3 17:17:31 IST 2009
     - Unified the two calls to stat() (and several calls to other file

lib/File/Find/Object.pm

     bless $self, $class;
 
     $top->_fill_actions($self);
-    $self->idx(-1);
+    $self->idx(0);
 
     return $self;
 }
             _def_actions
             _dir_stack
             item_obj
-            _path_top
             _targets
             _target_index
             _top_stat
 
     $tree->_calc_default_actions();
 
-    $tree->_path_top(
+    push @{$tree->_dir_stack()},
         File::Find::Object::TopPath->new($tree)
-    );
+        ;
 
     $tree->_last_dir_scanned(undef);
 
 {
     my $self = shift;
 
-    return $self->_dir_stack->[-1] || $self->_path_top();
+    return $self->_dir_stack->[-1];
 }
 
 =begin Removed
 {
     my ($self, $level) = @_;
 
-    # TODO : Unify.
-    if ($level->idx() < 0)
+    if ($level->idx() == 0)
     {
         return undef;
     }
-    elsif ($level->idx() >= 1)
+    else
     {
         return $self->_dir_stack()->[$level->idx()-1];
     }
-    else
-    {
-        return $self->_path_top();
-    }
 }
 
 sub _current_father {
 
     my $st = $self->_dir_stack();
 
-    if ($father->idx < 0)
+    if ($father->idx == 0)
     {
-        @$st = ();
+        splice(@$st, 1);
         delete($self->{_st});
     }
     else
     {
         splice(@$st, $father->idx()+1);
-        splice(@{$self->_curr_comps()}, $father->idx()+2);
+        splice(@{$self->_curr_comps()}, $father->idx()+1);
         
         # If depth is false, then we no longer need the _curr_path
         # of the directories above the previously-set value, because we 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.