*** /usr/local/bin/cons Thu Aug 10 17:22:15 2000 --- /home/brianp/bin/cons Tue Aug 15 21:00:22 2000 *************** *** 345,350 **** --- 345,352 ---- # Walk up the directory hierarchy looking for a Conscript file (if -t set). my $target_top; + #brianp - original + if (0) { if ($param::traverse) { my $cwd = cwd(); my $ttop = dir::lookupdir(undef, $cwd); *************** *** 362,367 **** --- 364,399 ---- # Set up $dir::top and $dir::cwd, now that we are in the right directory. dir::init(); + } + #brianp - reworked + if ($param::traverse) { + my $cwd = cwd(); + my $topfile = File::Spec->catfile($cwd,$param::topfile); + unless (-f $topfile) { + my ($vol, $dir, $file) = File::Spec->splitpath($topfile); + my @dirs = File::Spec->splitdir($dir); + my @targ_dirs = (); + pop @dirs; + unshift @targ_dirs, pop @dirs; + while (! -f File::Spec->catpath($vol, @dirs, $file)) { + die("$0: unable to find $param::topfile.\n") unless scalar @dirs; + unshift @targ_dirs, pop @dirs; + } + $cwd = File::Spec->catpath($vol, @dirs, ''); + chdir($cwd); + # set to the relative path until after calling dir::init() + $target_top = File::Spec->catdir(@targ_dirs); + } + } + + # Set up $dir::top and $dir::cwd, now that we are in the right directory. + dir::init(); + + if ($target_top) { + # target_top now made a dir node + $target_top = dir::lookupdir($dir::top, $target_top); + @targets = map($target_top->lookup($_)->path, @targets); + } # Now handle override file. package override;