From c6afa43a35f6c3ebdf2915fa16b95707c344dae8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Matox?= Date: Mon, 20 Jan 2003 19:38:50 +0000 Subject: [PATCH] Fix case where the relyxed name already exists as a directory git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5975 a592a061-630c-0410-9148-cb99ea01b6c8 --- lib/ChangeLog | 5 +++++ lib/reLyX/reLyXmain.pl | 17 ++++++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/lib/ChangeLog b/lib/ChangeLog index eb91ce9f2b..6dab35984a 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,8 @@ +2003-01-20 Michael Schmitt + + * reLyX/reLyXmain.pl: fixes the problem where a directory has + the same name as a TeX file. + 2003-01-17 Michael Schmitt * lib/examples/*.lyx: diff --git a/lib/reLyX/reLyXmain.pl b/lib/reLyX/reLyXmain.pl index 4db42ceb65..3b3c463a83 100644 --- a/lib/reLyX/reLyXmain.pl +++ b/lib/reLyX/reLyXmain.pl @@ -8,7 +8,7 @@ # # This code usually gets called by the reLyX wrapper executable # -# $Id: reLyXmain.pl,v 1.4 2001/08/31 07:54:05 jamatos Exp $ +# $Id: reLyXmain.pl,v 1.5 2003/01/20 19:38:50 jamatos Exp $ # require 5.002; # Perl 5.001 doesn't work. Perl 4 REALLY doesn't work. @@ -65,7 +65,7 @@ BEGIN{$Success = 0} # # Print welcome message including version info -my $version_info = '$Date: 2001/08/31 07:54:05 $'; # RCS puts checkin date here +my $version_info = '$Date: 2003/01/20 19:38:50 $'; # RCS puts checkin date here $version_info =~ s&.*?(\d+/\d+/\d+).*&$1&; # take out just the date info warn "reLyX, the LaTeX to LyX translator. Revision date $version_info\n\n"; @@ -145,9 +145,9 @@ if (defined($opt_o)) { # Read personal syntax.default, or system-wide if there isn't a personal one # Then read other syntax files, given by the -s option my $default_file = "$dot_lyxdir/reLyX/$syntaxname"; -if (! -e $default_file) { +if (! -f $default_file) { $default_file = "$lyxdir/reLyX/$syntaxname"; - die "cannot find default syntax file $default_file" unless -e $default_file; + die "cannot find default syntax file $default_file" unless -f $default_file; } my @syntaxfiles = ($default_file); push (@syntaxfiles, (split(/,/,$opt_s))) if defined $opt_s; @@ -288,9 +288,9 @@ sub test_file { #$path .= '/' unless $path =~ /\/$/; # fix BUG in perl5.002 fileparse! # Try adding .tex to filename if you can't find the file the user input - unless (-e $File) { + unless (-f $File) { if (! $suffix) { # didn't have a valid suffix. Try adding one - if (-e "$File.tex") { + if (-f "$File.tex") { $suffix = ".tex"; } else { warn "\nCan't find input file $File or $File.tex\n"; @@ -322,7 +322,10 @@ sub test_file { # Check for files that already exist my $lname = $PathBase . ".lyx"; if (-e $lname) { - if ($opt_f) { + if (-d $lname) { + warn "\nLyX file $lname already exists and is a directory.\n"; + return @return_error; + } elsif ($opt_f) { warn "Will overwrite file $lname\n" if $opt_d; } else { warn "\nLyX file $lname already exists. Use -f to overwrite\n"; -- 2.39.2