summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Spiers <stow@adamspiers.org>2012-02-18 20:12:14 +0000
committerAdam Spiers <stow@adamspiers.org>2012-02-18 20:33:34 +0000
commita127d22457f11e67aab623b22fa19add83da598f (patch)
tree06a69cbd9337cfb5338f8535ce85dd57e74f8ad3
parent91c816e32d64780215f3f0f9f5a7cdcf70a058fa (diff)
downloadstow-a127d22457f11e67aab623b22fa19add83da598f.tar.gz
Improve error message when package is not found.
-rw-r--r--NEWS6
-rwxr-xr-xlib/Stow.pm.in12
2 files changed, 13 insertions, 5 deletions
diff --git a/NEWS b/NEWS
index 4ccd179..2f4f87e 100644
--- a/NEWS
+++ b/NEWS
@@ -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.
diff --git a/lib/Stow.pm.in b/lib/Stow.pm.in
index 4479b6a..7ef1828 100755
--- a/lib/Stow.pm.in
+++ b/lib/Stow.pm.in
@@ -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}++;