From 7ba8fb50b24a25f49b985f39ed295413b7302c25 Mon Sep 17 00:00:00 2001
From: Manuel Thalmann <m@nuth.ch>
Date: Tue, 25 Jul 2023 10:51:16 +0200
Subject: [PATCH] Print debug info about Nextcloud sync

---
 scripts/Windows/Scripts/Context.ps1 | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/scripts/Windows/Scripts/Context.ps1 b/scripts/Windows/Scripts/Context.ps1
index 034c5bac..24d539a4 100644
--- a/scripts/Windows/Scripts/Context.ps1
+++ b/scripts/Windows/Scripts/Context.ps1
@@ -248,6 +248,8 @@ class Context {
     }
 
     [void] AddNextcloudSync([string] $localPath, [string] $targetPath, [bool] $virtualFiles) {
+        Write-Host "Adding a Nextcloud sync";
+        Write-Information "$targetPath <=> $localPath";
         $pattern = "^\d+\\Folders(?:WithPlaceholders)?\\(\d+)";
 
         $folderID = (
@@ -265,6 +267,7 @@ class Context {
             $configName += "WithPlaceholders";
         }
 
+        Write-Information "Stopping Nextcloud process";
         $nextcloudProcess = Get-Process nextcloud;
         $nextcloudPath = [string]$nextcloudProcess[0].Path;
         $nextcloudProcess | Stop-Process -Force;
@@ -288,6 +291,10 @@ class Context {
                 $_;
             } | Set-Content $this.GetNextcloudConfigFile();
 
+        Write-Information "New nextcloud config:";
+        Write-Information Get-Content $($this.GetNextcloudConfigFile());
+
+        Write-Information "Restarting Nextcloud";
         Start-Process $nextcloudPath;
     }