From 1a38183344f1da17e036fe3db57512cbaa270fd0 Mon Sep 17 00:00:00 2001 From: Ivandro Jao Date: Mon, 30 Sep 2024 20:50:02 +0100 Subject: [PATCH] Create missing directories for dictionary files Updated InterjectionsRepository to check if the dictionary directory exists before attempting to save files. If the directory does not exist, it will now be created automatically. This change prevents potential errors during file saving operations. Signed-off-by: Ivandro Jao --- src/libse/Common/InterjectionsRepository.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/libse/Common/InterjectionsRepository.cs b/src/libse/Common/InterjectionsRepository.cs index 898292c99..1a72c4b81 100644 --- a/src/libse/Common/InterjectionsRepository.cs +++ b/src/libse/Common/InterjectionsRepository.cs @@ -87,6 +87,11 @@ namespace Nikse.SubtitleEdit.Core.Common } } + if (!Directory.Exists(Configuration.DictionariesDirectory)) + { + Directory.CreateDirectory(Configuration.DictionariesDirectory); + } + var fullFileName = Path.Combine(Configuration.DictionariesDirectory, userFileName); xmlDocument.Save(fullFileName); }