Ignore:
Timestamp:
02/07/10 11:19:10 (2 years ago)
Author:
kthakore
Message:

Add a fix for ticket #845. The problem was that when padre is called like so 'padre somedir/file.pl'. The resulting Document object had filename = somedir/file.pl and projectdir = somdir. So when we try to run the code the command created chdir in get_command once to projectdir and then tries to run somedir/file.pl. So it crashes by try to chdir twice in somedir then run file. To fix this I made it check before chdir to see if the somedir exists. Then I also see if Document->{filename} has a \|\/\ in it and if it does split and take the last element.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Padre/lib/Padre/Wx/Main.pm

    r10605 r10606  
    23902390            SCOPE: { 
    23912391                require File::pushd; 
    2392                 my $pushd = File::pushd::pushd( $document->project_dir ); 
     2392                # Ticket #845 this project_dir is created in correctly when you do padre somedir/script.pl and run F5 on that 
     2393                # real stupid think so we don't crash 
     2394                # to fix this $document->get_command needs to recognize which folder it is in 
     2395                # The other part of this fix is in lib/Padre/Document/Perl.pm in get_command 
     2396                # Please feel free to fix this 
     2397                my $pushd = File::pushd::pushd( $document->project_dir) if -e $document->project_dir; 
    23932398                $self->run_command($cmd); 
    23942399            } 
     
    24042409                SCOPE: { 
    24052410                    require File::pushd; 
    2406                     my $pushd = File::pushd::pushd( $document->project_dir ); 
     2411                    my $pushd = File::pushd::pushd( $document->project_dir ) if -e  $document->project_dir; 
    24072412                    $self->run_command($cmd); 
    24082413                } 
Note: See TracChangeset for help on using the changeset viewer.