fix(themes): keep last-known-good custom theme on transient file-lock

This commit is contained in:
2026-05-07 19:51:43 +02:00
parent aff2528a6f
commit e4ee7aaafa
2 changed files with 24 additions and 6 deletions
+5 -1
View File
@@ -63,7 +63,11 @@ internal static class ThemeJsonLoader
public static Theme LoadFromFile(string path)
{
var json = File.ReadAllText(path);
// FileShare.Read lets concurrent readers and well-behaved editors share
// the handle; atomic-replace editors still raise IOException, caught upstream.
using var stream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read);
using var reader = new StreamReader(stream);
var json = reader.ReadToEnd();
return LoadFromString(json);
}