From c8a5e04d5029001cb01d3d4e7fa9ec0b981d3cd3 Mon Sep 17 00:00:00 2001 From: "Shi..." Date: Sat, 1 Nov 2025 11:37:41 +0100 Subject: [PATCH] fix: prevent redundant folders when using custom notes path --- .../Community.PowerToys.Run.Plugin.QuickNotes/Main.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/QuickNotes/Community.PowerToys.Run.Plugin.QuickNotes/Main.cs b/QuickNotes/Community.PowerToys.Run.Plugin.QuickNotes/Main.cs index 7831358..ca4a05f 100644 --- a/QuickNotes/Community.PowerToys.Run.Plugin.QuickNotes/Main.cs +++ b/QuickNotes/Community.PowerToys.Run.Plugin.QuickNotes/Main.cs @@ -267,11 +267,11 @@ public void Init(PluginInitContext context) Context.API.ThemeChanged += OnThemeChanged; var customPath = Environment.GetEnvironmentVariable(CUSTOM_PATH_ENV_VAR); - var appDataPath = string.IsNullOrEmpty(customPath) - ? Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + var appDataPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); + var powerToysPath = string.IsNullOrEmpty(customPath) + ? Path.Combine(appDataPath, "Microsoft", "PowerToys", "QuickNotes") : customPath; - - var powerToysPath = Path.Combine(appDataPath, "Microsoft", "PowerToys", "QuickNotes"); + if (!Directory.Exists(powerToysPath)) Directory.CreateDirectory(powerToysPath);