Improve error message when package is not found.

This commit is contained in:
Adam Spiers 2012-02-18 20:12:14 +00:00
parent 91c816e32d
commit a127d22457
2 changed files with 13 additions and 5 deletions

6
NEWS
View file

@ -2,6 +2,12 @@ News file for Stow.
* Changes in version 2.1.4
** Improve error message when stow package is not found.
The error message displayed a path to the missing stow package
which was relative to the target directory rather than the cwd,
which was confusing for the user.
** Test suite improvements
The test suite has been tightened up slightly.

View file

@ -248,8 +248,9 @@ sub plan_unstow {
$self->within_target_do(sub {
for my $package (@packages) {
if (not -d join_paths($self->{stow_path}, $package)) {
error("The stow directory $self->{dir} does not contain package $package");
my $path = join_paths($self->{stow_path}, $package);
if (not -d $path) {
error("The stow directory $self->{stow_path} does not contain package $package");
}
debug(2, "Planning unstow of package $package...");
if ($self->{compat}) {
@ -286,15 +287,16 @@ sub plan_stow {
$self->within_target_do(sub {
for my $package (@packages) {
if (not -d join_paths($self->{stow_path}, $package)) {
error("The stow directory $self->{dir} does not contain package $package");
my $path = join_paths($self->{stow_path}, $package);
if (not -d $path) {
error("The stow directory $self->{stow_path} does not contain package $package");
}
debug(2, "Planning stow of package $package...");
$self->stow_contents(
$self->{stow_path},
$package,
'.',
join_paths($self->{stow_path}, $package), # source from target
$path, # source from target
);
debug(2, "Planning stow of package $package... done");
$self->{action_count}++;