Filewatcher File Search File Search
Catalog
Content Search
» » » » adblock-plus_1.2.1.orig.tar.gz » Content »
pkg://adblock-plus_1.2.1.orig.tar.gz:720035/  info  downloads

remove_string.pl

#!/usr/bin/perl -w

use strict;

my ($file, $string) = @ARGV;

opendir(local *DIR, "chrome/locale") or die "Could not open directory chrome/locale";
my @locales = sort {$a cmp $b} grep {!/[^\w\-]/} readdir(DIR);
closedir(DIR);

foreach my $locale (@locales) {
  open(local *FILE, "chrome/locale/$locale/$file") or ((warn "Could not open file chrome/locale/$locale/$file") && next);
  binmode(FILE);
  local $/;
  my $data = <FILE>;
  close(FILE);

  if ($file =~ /\.dtd$/) {
    $data =~ s/<!ENTITY\s+$string\s+"[^"]*">\s*//gs or ((warn "String $string not found in file chrome/locale/$locale/$file") && next);
  }
  else {
    $data =~ s/^$string=.*\n//gm or (warn "String $string not found in file chrome/locale/$locale/$file" && next);
  }

  open(FILE, ">chrome/locale/$locale/$file") or die "Could not write file chrome/locale/$locale/$file";
  binmode(FILE);
  print FILE $data;
  close(FILE);
}
Results 1 - 1 of 1
Help - FTP Sites List - Software Dir.
Search over 15 billion files
© 1997-2017 FileWatcher.com