small tidying
This commit is contained in:
parent
b623fb6de6
commit
a37e8f00ed
1 changed files with 12 additions and 8 deletions
20
Stow.pm
20
Stow.pm
|
@ -356,25 +356,30 @@ sub StowContents {
|
||||||
|
|
||||||
sub StowDir {
|
sub StowDir {
|
||||||
my($dir, $stow) = @_;
|
my($dir, $stow) = @_;
|
||||||
my(@dir) = split(/\/+/, $dir);
|
my @dir = split(/\/+/, $dir);
|
||||||
my($collection) = shift(@dir);
|
my $collection = shift(@dir);
|
||||||
my($subdir) = &JoinPaths('/', @dir);
|
my $subdir = &JoinPaths('/', @dir);
|
||||||
my($linktarget, $stowsubdir);
|
|
||||||
|
|
||||||
warn "Stowing directory $dir\n" if ($opts{verbose} > 1);
|
warn "Stowing directory $dir\n" if ($opts{verbose} > 1);
|
||||||
|
|
||||||
my $subdirPath = &JoinPaths($opts{target}, $subdir);
|
my $subdirPath = &JoinPaths($opts{target}, $subdir);
|
||||||
if (-l $subdirPath) {
|
if (-l $subdirPath) {
|
||||||
($linktarget = readlink($subdirPath))
|
# We found a link; now let's see if we should remove it.
|
||||||
|| die "$RealScript: Could not read link $subdirPath ($!)\n";
|
my $linktarget = readlink($subdirPath);
|
||||||
|
$linktarget or die "$RealScript: Could not read link $subdirPath ($!)\n";
|
||||||
|
|
||||||
|
# Does the link point to somewhere within the stow directory?
|
||||||
my $stowsubdir = &FindStowMember(
|
my $stowsubdir = &FindStowMember(
|
||||||
&JoinPaths($opts{target}, @dir[0..($#dir - 1)]),
|
&JoinPaths($opts{target}, @dir[0..($#dir - 1)]),
|
||||||
$linktarget
|
$linktarget,
|
||||||
);
|
);
|
||||||
unless ($stowsubdir) {
|
unless ($stowsubdir) {
|
||||||
|
# No, so we can't touch it.
|
||||||
&Conflict($dir, $subdir, 1);
|
&Conflict($dir, $subdir, 1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Yes it does.
|
||||||
if (-e &JoinPaths($opts{stow}, $stowsubdir)) {
|
if (-e &JoinPaths($opts{stow}, $stowsubdir)) {
|
||||||
if ($stowsubdir eq $dir) {
|
if ($stowsubdir eq $dir) {
|
||||||
warn sprintf("%s already points to %s\n",
|
warn sprintf("%s already points to %s\n",
|
||||||
|
@ -415,7 +420,6 @@ sub StowNondir {
|
||||||
my(@file) = split(/\/+/, $file);
|
my(@file) = split(/\/+/, $file);
|
||||||
my($collection) = shift(@file);
|
my($collection) = shift(@file);
|
||||||
my($subfile) = &JoinPaths(@file);
|
my($subfile) = &JoinPaths(@file);
|
||||||
my($linktarget, $stowsubfile);
|
|
||||||
|
|
||||||
my $subfilePath = &JoinPaths($opts{target}, $subfile);
|
my $subfilePath = &JoinPaths($opts{target}, $subfile);
|
||||||
if (-l $subfilePath) {
|
if (-l $subfilePath) {
|
||||||
|
|
Loading…
Reference in a new issue