Permalink
Browse files

removed some -r checks are they can be wrong in some cases

test for file readability (-r) returns false in some cases for non-local readable files
  • Loading branch information...
squentin committed Mar 13, 2011
1 parent bb785ed commit e572e4ff6ebb0d484c104cf50c3beaccb4efe8b0
Showing with 31 additions and 29 deletions.
  1. +3 −3 apeheader.pm
  2. +3 −3 flacheader.pm
  3. +2 −2 gmusicbrowser.pl
  4. +2 −2 gmusicbrowser_layout.pm
  5. +6 −4 gmusicbrowser_songs.pm
  6. +3 −3 m4aheader.pm
  7. +3 −3 mp3header.pm
  8. +3 −3 mpcheader.pm
  9. +3 −3 oggheader.pm
  10. +3 −3 wvheader.pm
View
@@ -25,9 +25,9 @@ sub new
{ my ($class,$file,$findlength)=@_;
my $self=bless {}, $class;
local $_;
# check that the file exists and is readable
unless ( -e $file && -r $file )
{ warn "File '$file' does not exist or cannot be read.\n";
# check that the file exists
unless (-e $file)
{ warn "File '$file' does not exist.\n";
return undef;
}
$self->{filename} = $file;
View
@@ -27,9 +27,9 @@ sub new
{ my ($class,$file)=@_;
my $self=bless {}, $class;
local $_;
# check that the file exists and is readable
unless ( -e $file && -r $file )
{ warn "File '$file' does not exist or cannot be read.\n";
# check that the file exists
unless (-e $file)
{ warn "File '$file' does not exist.\n";
return undef;
}
$self->{filename} = $file;
View
@@ -3994,7 +3994,7 @@ sub ChoosePix
if ($response eq 'ok')
{ $ret= $dialog->get_uri;
$ret= $ret=~s#^file://## ? $ret=decode_url($ret) : undef;
unless (-r $ret) { warn "can't read $ret\n"; $ret=undef; }
unless (-e $ret) { warn "can't find $ret\n"; $ret=undef; }
$ret.=":$nb" if $nb;
}
elsif ($response eq 'reject') {$ret='0'}
@@ -8532,7 +8532,7 @@ sub load
return unless $file;
my $nb= $file=~s/:(\d+|\w+)$// ? $1 : undef; #index number for embbeded pictures
unless (-r $file) {warn "$file not found\n"; return undef;}
unless (-e $file) {warn "$file not found\n"; return undef;}
my $loader=Gtk2::Gdk::PixbufLoader->new;
$loader->signal_connect(size_prepared => \&PixLoader_callback,$size) if $size;
View
@@ -728,8 +728,8 @@ sub InitLayouts
sub ReadLayoutFile
{ my $file=shift;
my $path=$file; $path=~s#[^/]+$##;
return unless -f $file && -r $file;
open my$fh,"<:utf8",$file;
return unless -f $file;
open my$fh,"<:utf8",$file or do { warn $!; return };
my $first;
while (1)
{ my ($next,$longline);
View
@@ -1261,22 +1261,24 @@ sub New
sub ReReadFile
{ my ($ID,$force,$noremove)=@_;
my $file= GetFullFilename($ID);
if (-r $file)
if (-e $file)
{ my ($size1,$modif1)=Songs::Get($ID,qw/size modif/);
my ($size2,$modif2)=(stat $file)[7,9];
my $checklength= ($size1!=$size2 || ($force && $force==2)) ? 2 : 0;
return 1 unless $checklength || $force || $modif1!=$modif2;
my ($values,$estimated)=FileTag::Read($file,$checklength);
return unless $values;
$values->{size}=$size2;
$values->{modif}=$modif2;
my @changed=$DIFFsub->($ID,$values);
return unless @changed;warn "Changed fields : @changed";
return unless @changed;
warn "Changed fields : @changed" if $::debug;
::SongsChanged([$ID],\@changed);
my %changed; $changed{$_}=undef for @changed;
Changed(\%changed,[$ID]);
}
elsif (!$noremove) #file not found/readable
{ warn "can't read file '$file'\n";
elsif (!$noremove) #file not found
{ warn "can't find file '$file'\n";
::SongsRemove([$ID]);
}
}
View
@@ -38,9 +38,9 @@ sub new
{ my ($class,$file)=@_;
my $self=bless {}, $class;
# check that the file exists and is readable
unless ( -e $file && -r $file )
{ warn "File '$file' does not exist or cannot be read.\n";
# check that the file exists
unless (-e $file)
{ warn "File '$file' does not exist.\n";
return undef;
}
$self->{filename} = $file;
View
@@ -93,9 +93,9 @@ sub new
{ my ($class,$file,$findlength)=@_;
my $self=bless {}, $class;
local $_;
# check that the file exists and is readable
unless ( -e $file && -r $file )
{ warn "File '$file' does not exist or cannot be read.\n";
# check that the file exists
unless (-e $file)
{ warn "File '$file' does not exist.\n";
return undef;
}
$self->{filename} = $file;
View
@@ -24,9 +24,9 @@ sub new
{ my ($class,$file,$findlength)=@_;
my $self=bless {}, $class;
local $_;
# check that the file exists and is readable
unless ( -e $file && -r $file )
{ warn "File '$file' does not exist or cannot be read.\n";
# check that the file exists
unless (-e $file)
{ warn "File '$file' does not exist.\n";
return undef;
}
$self->{filename} = $file;
View
@@ -118,9 +118,9 @@ sub new
{ my ($class,$file)=@_;
my $self=bless {}, $class;
# check that the file exists and is readable
unless ( -e $file && -r $file )
{ warn "File '$file' does not exist or cannot be read.\n";
# check that the file exists
unless (-e $file)
{ warn "File '$file' does not exist.\n";
return undef;
}
$self->{filename} = $file;
View
@@ -19,9 +19,9 @@ sub new
{ my ($class,$file,$findlength)=@_;
my $self=bless {}, $class;
local $_;
# check that the file exists and is readable
unless ( -e $file && -r $file )
{ warn "File '$file' does not exist or cannot be read.\n";
# check that the file exists
unless (-e $file)
{ warn "File '$file' does not exist.\n";
return undef;
}
$self->{filename} = $file;

0 comments on commit e572e4f

Please sign in to comment.