Skip to content

Commit

Permalink
Avoid to go into GIT, SVN and CVS directories.
Browse files Browse the repository at this point in the history
see #96

Signed-off-by: Stéphane Galland <galland@arakhne.org>
  • Loading branch information
gallandarakhneorg committed Sep 26, 2015
1 parent bfb11d5 commit 780d092
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 19 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
autolatex 37.0
autolatex 38.0
4 changes: 2 additions & 2 deletions autolatex.pl
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ (\@\@)
my $dir = shift @dirs;
opendir(*DIR, "$dir") or printErr("$dir: $!");
while (my $fn = readdir(*DIR)) {
if ($fn ne File::Spec->updir() && $fn ne File::Spec->curdir()) {
if (!isIgnorableDirectory($fn)) {
my $ffn = File::Spec->rel2abs(File::Spec->catfile("$dir","$fn"));
if (-d "$ffn") {
push @dirs, "$ffn";
Expand Down Expand Up @@ -610,7 +610,7 @@ sub al_run_cleanall {
if (opendir(*DIR, "$dir")) {
my @files_to_remove = ();
while (my $fn = readdir(*DIR)) {
if ($fn ne File::Spec->curdir() && $fn ne File::Spec->updir()
if ((!isIgnorableDirectory($fn))
&& $fn =~ /^(?:$localpattern)$/s) {
my $ffn = File::Spec->catfile("$dir","$fn");
push @files_to_remove, $ffn;
Expand Down
4 changes: 2 additions & 2 deletions pm/AutoLaTeX/Core/Main.pm
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ sub detectMainTeXFile(\%) {
opendir(*DIR,$configuration->{'__private__'}{'output.directory'}) or printErr($configuration->{'__private__'}{'output.directory'}.":","$!");
my @texfiles = ();
while (my $subfile = readdir(*DIR)) {
if ($subfile =~ /\.tex$/i && $subfile ne 'autolatex_autogenerated.tex') {
if ((!isIgnorableDirectory($subfile)) && $subfile =~ /\.tex$/i && $subfile ne 'autolatex_autogenerated.tex') {
push @texfiles, "$subfile";
}
}
Expand Down Expand Up @@ -462,7 +462,7 @@ sub mainProgram(;$) {
opendir(*DIR,$configuration{'__private__'}{'output.directory'}) or printErr($configuration{'__private__'}{'output.directory'}.":","$!");
my @istfiles = ();
while (my $subfile = readdir(*DIR)) {
if ($subfile =~ /\.ist$/i) {
if (!isIgnorableDirectory($subfile) && $subfile =~ /\.ist$/i) {
push @istfiles, File::Spec->catfile(
$configuration{'__private__'}{'output.directory'},
"$subfile");
Expand Down
18 changes: 9 additions & 9 deletions pm/AutoLaTeX/Core/Translator.pm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# autolatex - Translator.pm
# Copyright (C) 2014 Stephane Galland <galland@arakhne.org>
# Copyright (C) 2014-2015 Stephane Galland <galland@arakhne.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -37,7 +37,7 @@ The provided functions are:
=cut
package AutoLaTeX::Core::Translator;

$VERSION = '19.0';
$VERSION = '20.0';
@ISA = ('Exporter');
@EXPORT = qw( &getTranslatorFilesFrom &getLoadableTranslatorList &getTranslatorList
&detectConflicts @ALL_LEVELS
Expand Down Expand Up @@ -218,7 +218,7 @@ sub getTranslatorFilesFrom(\%$\%$$$;$) {
formatText(_T("Get translator list from {}"),$dirname);
if (opendir(*DIR,"$dirname")) {
while (my $file = readdir(*DIR)) {
if ( $file ne File::Spec->curdir() && $file ne File::Spec->updir() ) {
if ( ! isIgnorableDirectory($file) ) {
my $fullname = File::Spec->catfile("$dirname","$file");
if (-d "$fullname") {
push @dirs, "$fullname" if ($recursive);
Expand Down Expand Up @@ -415,9 +415,9 @@ sub getLoadableTranslatorList(\%) {
opendir(*DIR,"$filename")
or printErr("$filename:","$!");
while (my $file = readdir(*DIR)) {
my $fullname = File::Spec->rel2abs(File::Spec->catfile("$filename","$file"));
if (($file ne File::Spec->curdir())&&($file ne File::Spec->updir())&&
if ((!isIgnorableDirectory($file))&&
($file =~ /^(.*)\.transdef$/i)) {
my $fullname = File::Spec->rel2abs(File::Spec->catfile("$filename","$file"));
my $scriptname = "$1";
if ((!exists $_[0]->{"$scriptname.include module"})||
(cfgBoolean($_[0]->{"$scriptname.include module"}))) {
Expand Down Expand Up @@ -509,9 +509,9 @@ sub getTranslatorList(\%;$) {
printDbgIndent();
opendir(*DIR,"$filename") or printErr("$filename:","$!");
while (my $file = readdir(*DIR)) {
my $fullname = File::Spec->rel2abs(File::Spec->catfile("$filename","$file"));
if (($file ne File::Spec->curdir())&&($file ne File::Spec->updir())&&
if ((!isIgnorableDirectory($file))&&
($file =~ /^(.*)\.transdef$/i)) {
my $fullname = File::Spec->rel2abs(File::Spec->catfile("$filename","$file"));
my $scriptname = "$1";
$translators{"$scriptname"} = extractTranslatorNameComponents($scriptname);
$translators{"$scriptname"}{'human-readable'} = makeTranslatorHumanReadable($translators{"$scriptname"});
Expand Down Expand Up @@ -874,7 +874,7 @@ sub _runTranslator($$$$$$$$) {
my $ext = $translators->{"$transname"}{'transdef'}{'OUTPUT_EXTENSIONS'}{'value'}[0] || '';
my $bn = basename($out, $ext);
while (!defined($outChange) && ($fn = readdir(*DIR))) {
if ($fn ne File::Spec->updir() && $fn ne File::Spec->curdir()
if (!isIgnorableDirectory($fn)
&& $fn =~ /^(\Q${bn}_\E.*)\Q$ext\E$/s) {
my $ffn = File::Spec->catfile("$dirname", "$fn");
my $t = lastFileChange("$ffn");
Expand Down Expand Up @@ -1240,7 +1240,7 @@ sub loadTranslatableImageList(\%\%;$) {
$dir = File::Spec->rel2abs($dir, $configuration->{'__private__'}{'input.project directory'});
if (opendir(*DIR, "$dir")) {
while (my $fn = readdir(*DIR)) {
if ($fn ne File::Spec->curdir() && $fn ne File::Spec->updir()) {
if (!isIgnorableDirectory($fn)) {
my $ffn = File::Spec->catfile("$dir", "$fn");
if (-d "$ffn") {
push @dirs, "$ffn";
Expand Down
19 changes: 16 additions & 3 deletions pm/AutoLaTeX/Core/Util.pm
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ package AutoLaTeX::Core::Util;

our $INTERNAL_MESSAGE_PREFIX = '';

our $VERSION = '36.0';
our $VERSION = '37.0';

@ISA = ('Exporter');
@EXPORT = qw( &isHash &isArray &removeFromArray &arrayContains &getAutoLaTeXDir
Expand All @@ -51,7 +51,8 @@ our $VERSION = '36.0';
&readFileLines &writeFileLines &runCommandOrFailRedirectTo
&runCommandSilently &removePathPrefix &trim &trim_ws &formatText
&makeMessage &makeMessageLong &secure_unlink &str2language
&killSubProcesses &toANSI &toUTF8 &redirectToSTDOUT &redirectToSTDERR ) ;
&killSubProcesses &toANSI &toUTF8 &redirectToSTDOUT &redirectToSTDERR
&isIgnorableDirectory ) ;
@EXPORT_OK = qw( $INTERNAL_MESSAGE_PREFIX );

require 5.014;
Expand Down Expand Up @@ -327,7 +328,7 @@ sub showManual(@) {
opendir(*DIR,File::Spec->catfile(@_))
or die(_T("no manual page found\n").File::Spec->catfile(@_).": $!\n");
while (my $file = readdir(*DIR)) {
if (($file ne '.')&&($file ne '..')) {
if (!isIgnorableDirectory($file)) {
if ($file =~ /^\Q$filename\E[._\-]\Q$currentLocale$ext\E$/) {
$localePod = $file;
}
Expand Down Expand Up @@ -1426,6 +1427,18 @@ sub killSubProcesses() {
kill 9, @pids;
}

=pod
=item B<isIgnorableDirectory($)>
Replies if the given directory name is for directories to ignore.
=cut
sub isIgnorableDirectory($) {
my $file = shift || return 1;
return $file eq File::Spec->curdir() || $file eq File::Spec->updir()
|| $file eq ".git" || $file eq ".svn" || $file eq ".cvs";
}



Expand Down
4 changes: 2 additions & 2 deletions pm/AutoLaTeX/Make/Make.pm
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ use AutoLaTeX::TeX::BibCitationAnalyzer;
use AutoLaTeX::TeX::TeXDependencyAnalyzer;
use AutoLaTeX::TeX::IndexAnalyzer;

our $VERSION = '28.0';
our $VERSION = '29.0';

my $EXTENDED_WARNING_CODE = <<'ENDOFTEX';
%*************************************************************
Expand Down Expand Up @@ -563,7 +563,7 @@ die(Dumper(\%deps));
local *DIR;
opendir(*DIR, "$rootdir") or printErr("$rootdir: $!");
while (my $dir = readdir(*DIR)) {
if ($dir ne File::Spec->curdir() && $dir ne File::Spec->updir() && $dir =~ /^(.+?)\.aux$/) {
if ((!isIgnorableDirectory($dir)) && $dir =~ /^(.+?)\.aux$/) {
my $bibdb = "$1";
if ($bibdb ne "$rootbasename") {
my $auxfile = File::Spec->catfile("$rootdir", "$dir");
Expand Down

0 comments on commit 780d092

Please sign in to comment.