From f0ec242bc5c8bbac09a7fc693d264a882bb92b9f Mon Sep 17 00:00:00 2001 From: Pat Hartl Date: Tue, 20 Jan 2026 00:46:53 -0600 Subject: [PATCH] Set default snippets directory if blank --- LANCommander.Server.Services/ScriptService.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/LANCommander.Server.Services/ScriptService.cs b/LANCommander.Server.Services/ScriptService.cs index adcdcef6..0e1d5dbd 100644 --- a/LANCommander.Server.Services/ScriptService.cs +++ b/LANCommander.Server.Services/ScriptService.cs @@ -98,6 +98,19 @@ namespace LANCommander.Server.Services public IEnumerable GetSnippets() { + var storagePath = settingsProvider.CurrentValue.Server.Scripts.Snippets.StoragePath; + + if (string.IsNullOrWhiteSpace(storagePath)) + { + // Set default storage path + storagePath = AppPaths.GetConfigPath("Snippets"); + + settingsProvider.Update(s => + { + s.Server.Scripts.Snippets.StoragePath = storagePath; + }); + } + var files = Directory.GetFiles(settingsProvider.CurrentValue.Server.Scripts.Snippets.StoragePath, "*.ps1", SearchOption.AllDirectories); return files.Select(f =>