summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAdam Spiers <stow@adamspiers.org>2012-02-18 20:13:32 +0000
committerAdam Spiers <stow@adamspiers.org>2012-02-18 20:33:34 +0000
commited12c787df985896c8ba1c188af45b9fb637b017 (patch)
treebd9136bbaf1be309b7131291bd9dd62e65f3073f /lib
parent17d3586e842f0fae5ce9c3783eaf0959cfa005fc (diff)
downloadstow-ed12c787df985896c8ba1c188af45b9fb637b017.tar.gz
Add --no-folding option.
Diffstat (limited to 'lib')
-rwxr-xr-xlib/Stow.pm.in36
1 files changed, 26 insertions, 10 deletions
diff --git a/lib/Stow.pm.in b/lib/Stow.pm.in
index 7ef1828..101a422 100755
--- a/lib/Stow.pm.in
+++ b/lib/Stow.pm.in
@@ -54,16 +54,17 @@ our @default_global_ignore_regexps =
# These are the default options for each Stow instance.
our %DEFAULT_OPTIONS = (
- conflicts => 0,
- simulate => 0,
- verbose => 0,
- paranoid => 0,
- compat => 0,
- test_mode => 0,
- adopt => 0,
- ignore => [],
- override => [],
- defer => [],
+ conflicts => 0,
+ simulate => 0,
+ verbose => 0,
+ paranoid => 0,
+ compat => 0,
+ test_mode => 0,
+ adopt => 0,
+ 'no-folding' => 0,
+ ignore => [],
+ override => [],
+ defer => [],
);
=head1 CONSTRUCTORS
@@ -100,6 +101,8 @@ See the documentation for the F<stow> CLI front-end for information on these.
=item * adopt
+=item * no-folding
+
=item * ignore
=item * override
@@ -517,6 +520,15 @@ sub stow_node {
}
}
}
+ elsif ($self->{'no-folding'} && -d $path) {
+ $self->do_mkdir($target);
+ $self->stow_contents(
+ $self->{stow_path},
+ $package,
+ $target,
+ join_paths('..', $source),
+ );
+ }
else {
$self->do_link($source, $target);
}
@@ -994,6 +1006,10 @@ sub foldable {
my ($target) = @_;
debug(3, "--- Is $target foldable?");
+ if ($self->{'no-folding'}) {
+ debug(3, "--- no because --no-folding enabled");
+ return '';
+ }
opendir my $DIR, $target
or error(qq{Cannot read directory "$target" ($!)\n});