🎨 Support one-click addition of Microsoft Defender exclusions https://github.com/siyuan-note/siyuan/issues/13650

This commit is contained in:
Daniel 2024-12-29 10:35:55 +08:00
parent b3f55ac3b4
commit 203dbfa35a
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -26,6 +26,7 @@ import (
"path/filepath"
"runtime"
"strings"
"sync"
"syscall"
"github.com/88250/gulu"
@ -34,7 +35,12 @@ import (
"golang.org/x/sys/windows"
)
var microsoftDefenderLock = sync.Mutex{}
func AddMicrosoftDefenderExclusion() (err error) {
microsoftDefenderLock.Lock()
defer microsoftDefenderLock.Unlock()
if !gulu.OS.IsWindows() {
return
}
@ -91,6 +97,9 @@ func AutoProcessMicrosoftDefender() {
}
func checkMicrosoftDefender() {
microsoftDefenderLock.Lock()
defer microsoftDefenderLock.Unlock()
if !gulu.OS.IsWindows() || Conf.System.MicrosoftDefenderExcluded {
return
}