Set default snippets directory if blank
This commit is contained in:
parent
e777a061ea
commit
f0ec242bc5
1 changed files with 13 additions and 0 deletions
|
|
@ -98,6 +98,19 @@ namespace LANCommander.Server.Services
|
|||
|
||||
public IEnumerable<Snippet> 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 =>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue