Changeset 2203


Ignore:
Timestamp:
12/26/08 02:28:24 (3 years ago)
Author:
szabgab
Message:

improve the call that opens the CPAN Config file to use the setup_editors() method of Padre and to try to open the local MyConfig? file if the main file is not available

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Padre-Plugin-CPAN/lib/Padre/Plugin/CPAN.pm

    r2201 r2203  
    3434    my $default_dir = $INC{'CPAN.pm'}; 
    3535    $default_dir =~ s/\.pm$//is; # remove .pm 
    36     my $filename = 'Config.pm'; 
    37      
    38     # copy from MainWindow.pm sub on_open 
    39      
    40     my $file = File::Spec->catfile($default_dir, $filename); 
    41     Padre::DB->add_recent_files($file); 
    4236 
    43     # If and only if there is only one current file, 
    44     # and it is unused, close it. 
    45     if ( $self->{notebook}->GetPageCount == 1 ) { 
    46         if ( Padre::Documents->current->is_unused ) { 
    47             $self->on_close($self); 
     37    foreach my $file ( 
     38            File::Spec->catfile($default_dir, 'Config.pm'), 
     39            File::Spec->catfile(File::HomeDir->my_home, '.cpan', 'CPAN', 'MyConfig.pm') 
     40            ) { 
     41        if (-e $file) { 
     42            $self->setup_editors($file); 
     43            last; 
    4844        } 
    4945    } 
    50  
    51     $self->setup_editor($file); 
    52     $self->refresh_all; 
    5346} 
    5447 
Note: See TracChangeset for help on using the changeset viewer.