diff options
author | Norbert Preining <preining@logic.at> | 2010-09-28 14:39:02 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2010-09-28 14:39:02 +0000 |
commit | d548969ae703738120162e27b7decd10471f5ef7 (patch) | |
tree | cc4af7ea3209363c238458d16e7ee6f0a84eb2f6 | |
parent | cce309c8bb877f3ad84d0b94eecaa8bcb5b811e9 (diff) |
make error messages when backupdir is not specified or not a dir
more useful (but still needs to become more consistent!)
git-svn-id: svn://tug.org/texlive/trunk@19932 c570f23f-e606-0410-a88d-b1316a301751
-rwxr-xr-x | Master/texmf/scripts/texlive/tlmgr.pl | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/Master/texmf/scripts/texlive/tlmgr.pl b/Master/texmf/scripts/texlive/tlmgr.pl index 6941e472548..c6a5b182520 100755 --- a/Master/texmf/scripts/texlive/tlmgr.pl +++ b/Master/texmf/scripts/texlive/tlmgr.pl @@ -1892,24 +1892,29 @@ sub action_update { # cmd line --backup, we check for --backupdir, and if that is not given # we try to get the default from the tlpdb. If that doesn't work, exit. if ($opts{"backup"}) { - my $diebackupdir = 0; + my $diebackupmsg = ""; if (!$opts{"backupdir"}) { - $opts{"backupdir"} = norm_tlpdb_path($localtlpdb->option("backupdir")); + # no path has been specified on the command line, check for settings + # in the local tlpdb + my $tlpdbbackupdir = $localtlpdb->option("backupdir"); + $opts{"backupdir"} = norm_tlpdb_path($tlpdbbackupdir); if ($opts{"backupdir"}) { - # check again: + # ok, something is saved in the tlpdb, but we have to check if + # that directory actually exists $opts{"backupdir"} = abs_path($opts{"backupdir"}); - $diebackupdir = 1 if (! -d $opts{"backupdir"}); + if (!(defined($opts{"backupdir"}) && -d $opts{"backupdir"})) { + $diebackupmsg = "The backup directory\n $tlpdbbackupdir\nas specified in the local TLPDB does not exist, exiting.\n"; + } } else { # not set in the tlpdb, and not set on cmd line, but asked for # --backup - $diebackupdir = 1; + $diebackupmsg = "Backups should be made, but neither on the command line\nnor in the local TLPDB a backup directory has been specified, exiting.\n"; } } # no else branch necessary, we already checked that --backupdir if # given is ok, see above - if ($diebackupdir) { - tlwarn("You have asked for backups, but the backup directory as specified\n"); - tlwarn("in the local TLPDB or the cmd line does not exists, exiting.\n"); + if ($diebackupmsg) { + tlwarn($diebackupmsg); exit 1; } } |