Explorar el Código

only stow if stow option specified

Daniel Sheffield hace 1 mes
padre
commit
8952c7804f
Se han modificado 1 ficheros con 16 adiciones y 15 borrados
  1. 16 15
      park.ps1

+ 16 - 15
park.ps1

@@ -60,22 +60,23 @@ if ($Delete) {
     return
 }
 
-# Create symlinks
-Get-ChildItem -Path $SourceRoot -Recurse -File -Force | ForEach-Object {
-    $relativePath = $_.FullName.Substring($SourceRoot.Length).TrimStart('\', '/')
-    $targetFile = Join-Path $TargetRoot $relativePath
-    $targetDir = Split-Path $targetFile
-
-    if (-not (Test-Path $targetDir)) {
-        Write-Log "Creating dir: $targetDir" 2
+if ($Stow) {
+    Get-ChildItem -Path $SourceRoot -Recurse -File -Force | ForEach-Object {
+        $relativePath = $_.FullName.Substring($SourceRoot.Length).TrimStart('\', '/')
+        $targetFile = Join-Path $TargetRoot $relativePath
+        $targetDir = Split-Path $targetFile
+    
+        if (-not (Test-Path $targetDir)) {
+            Write-Log "Creating dir: $targetDir" 2
+            if (-not $Simulate) {
+                New-Item -ItemType Directory -Path $targetDir -Force | Out-Null
+            }
+        }
+    
+        Write-Log "Linking: $targetFile -> $($_.FullName)"
         if (-not $Simulate) {
-            New-Item -ItemType Directory -Path $targetDir -Force | Out-Null
+            New-Item -ItemType SymbolicLink -Path $targetFile -Target $_.FullName | Out-Null
         }
     }
-
-    Write-Log "Linking: $targetFile -> $($_.FullName)"
-    if (-not $Simulate) {
-        New-Item -ItemType SymbolicLink -Path $targetFile -Target $_.FullName | Out-Null
-    }
+    return
 }
-