Stow: Only show unwrap message if targets are folders

This commit is contained in:
Tim 2025-05-19 18:31:55 +02:00
parent 3059d26a60
commit ea00b5c47e

View File

@ -55,14 +55,18 @@ readonly class stow
if ($targetLink === $stowFile) {
line("File $targetFile is already stowed from $stowFile");
} else {
if ($this->unwrap) {
line("Unwrapping $targetFile from $targetLink");
unlink($targetFile);
mkdir($targetFile);
$this->run($targetLink, $targetFile);
$this->run($stowFile, $targetFile);
} else {
line("File $targetFile is linked from $targetLink, ignoring, add -w to unwrap");
if (is_dir($targetFile)) {
if ($this->unwrap) {
line("Unwrapping $targetFile from $targetLink");
unlink($targetFile);
mkdir($targetFile);
$this->run($targetLink, $targetFile);
$this->run($stowFile, $targetFile);
} else {
line("File $targetFile is linked from $targetLink, ignoring, add -w to unwrap");
}
}else{
line("File $targetFile is already linked from $targetLink");
}
}
return;