Skip to content

Commit

Permalink
Merge pull request #2516 from sanzoghenzo/fix-concurrent-config-access
Browse files Browse the repository at this point in the history
fix(config): allow concurrent access to pyrevit_config.ini
  • Loading branch information
jmcouffin authored Jan 13, 2025
2 parents 3ffad59 + 62aa006 commit 1dd083f
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 1dd083f

Please sign in to comment.