From 6d7587ad870193bccae06f95d3477be490d232a1 Mon Sep 17 00:00:00 2001 From: Andrea Ghensi Date: Mon, 13 Jan 2025 19:17:14 +0100 Subject: [PATCH] fix(config): allow concurrent access to pyrevit_config.ini fixes #2463 #2512 --- dev/pyRevitLabs/pyRevitLabs.PyRevit/PyRevitConfig.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dev/pyRevitLabs/pyRevitLabs.PyRevit/PyRevitConfig.cs b/dev/pyRevitLabs/pyRevitLabs.PyRevit/PyRevitConfig.cs index 2d447d55e..8ccc23e7d 100644 --- a/dev/pyRevitLabs/pyRevitLabs.PyRevit/PyRevitConfig.cs +++ b/dev/pyRevitLabs/pyRevitLabs.PyRevit/PyRevitConfig.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.IO; using pyRevitLabs.Common; using pyRevitLabs.Common.Extensions; @@ -31,7 +32,9 @@ public PyRevitConfig(string cfgFilePath, bool adminMode = false) { cfgOps.Encoding = CommonUtils.GetUTF8NoBOMEncoding(); _config = new IniFile(cfgOps); - _config.Load(cfgFilePath); + using (var cfgStream = File.Open(cfgFilePath, FileMode.Open, FileAccess.Read, FileShare.Read)) { + _config.Load(cfgStream); + } _adminMode = adminMode; } else