From ea00b5c47e75d65340f7a4c9d66a1e40f6cfb0fe Mon Sep 17 00:00:00 2001 From: Tim Date: Mon, 19 May 2025 18:31:55 +0200 Subject: [PATCH] Stow: Only show unwrap message if targets are folders --- php/includes/stow.php | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/php/includes/stow.php b/php/includes/stow.php index 7309520..06f68d0 100644 --- a/php/includes/stow.php +++ b/php/includes/stow.php @@ -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;