Skip to content

Commit

Permalink
fix(config): allow concurrent access to pyrevit_config.ini
Browse files Browse the repository at this point in the history
fixes #2463 #2512
  • Loading branch information
Andrea Ghensi committed Jan 13, 2025
1 parent 9e342d8 commit 6d7587a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion dev/pyRevitLabs/pyRevitLabs.PyRevit/PyRevitConfig.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;

using pyRevitLabs.Common;
using pyRevitLabs.Common.Extensions;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 6d7587a

Please sign in to comment.