Source

Kephra / lib / findlib.pl

Full commit
#!usr/bin/perl
use v5.12;
use warnings;

FindKephraLib->new->MainLoop;

package FindKephraLib;
use Cwd qw(abs_path);
use File::Find;
use File::Spec;
use FindBin qw($RealBin);
use Wx;
use base qw(Wx::App);

sub OnInit {
	my $app   = shift;
	my $frame = Wx::Frame->new( undef, -1, __PACKAGE__ , [-1,-1], [1000,800]);
	my $ed = Wx::TextCtrl->new($frame, -1, '',[-1,-1], [-1,-1], &Wx::wxTE_MULTILINE | &Wx::wxTE_READONLY);
	find({ preprocess => sub {
			grep {1 unless -d $_
			} 
			@_;
		}, 
		wanted => sub {
			return unless -r $_;
			if (-f $_ and substr($_, -9) eq 'Kephra.pm') {
				#$File::Find::dir #$File::Find::name # $_
		 		my $path = File::Spec->catdir( $RealBin, $File::Find::name );
		 		$path = File::Spec->canonpath( $path );
		 		$path = abs_path( $path );
				$ed->AppendText( $File::Find::name . "\n");
			}
			#$ed->AppendText( $_ . "\n")
	}, follow => 0, no_chdir => 1 }, '/');

	$frame->Show(1);
	$app->SetTopWindow($frame);
	1;
}