Skip to content

Commit d64465e

Browse files
committed
Update SRanipalTrackingInterface.cs
Brought back regzo2's method of clearing the file so we don't try to delete a file SRanipal is currently writing to.
1 parent d5a73d9 commit d64465e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

SRanipalExtTrackingModule/SRanipalTrackingInterface.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,12 @@ public override (bool eyeSuccess, bool expressionSuccess) Initialize(bool eyeAva
4949
foreach (string logFile in srLogFiles)
5050
{
5151
try {
52-
File.Delete(logFile);
52+
using (var stream = File.Open(logFile, FileMode.Open, FileAccess.Write, FileShare.ReadWrite))
53+
{
54+
Logger.LogDebug($"Clearing \"{logFile}\"");
55+
stream.SetLength(0);
56+
stream.Close();
57+
}
5358
}
5459
catch {
5560
Logger.LogWarning($"Failed to delete log file \"{logFile}\"");

0 commit comments

Comments
 (0)