mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-06 00:38:49 +01:00
🎨 Support one-click addition of Microsoft Defender exclusions https://github.com/siyuan-note/siyuan/issues/13650
This commit is contained in:
parent
8ad7d6aae2
commit
3ddeb651c3
1 changed files with 14 additions and 9 deletions
|
|
@ -62,11 +62,12 @@ func AddMicrosoftDefenderExclusion() (err error) {
|
|||
return
|
||||
}
|
||||
} else {
|
||||
logging.LogInfof("current user is not admin, use elevator to add Windows Defender exclusion path [%s, %s]", installPath, util.WorkspaceDir)
|
||||
elevator := filepath.Join(util.WorkingDir, "kernel", "elevator.exe")
|
||||
if "dev" == util.Mode || !gulu.File.IsExist(elevator) {
|
||||
elevator = filepath.Join(util.WorkingDir, "elevator", "elevator-"+runtime.GOARCH+".exe")
|
||||
elevator := getElevatorBin()
|
||||
if !gulu.File.IsExist(elevator) {
|
||||
logging.LogWarnf("not found elevator [%s]", elevator)
|
||||
return
|
||||
}
|
||||
logging.LogInfof("current user is not admin, use elevator to add Windows Defender exclusion path [%s, %s]", installPath, util.WorkspaceDir)
|
||||
|
||||
if !gulu.File.IsExist(elevator) {
|
||||
msg := fmt.Sprintf("not found elevator [%s]", elevator)
|
||||
|
|
@ -106,11 +107,7 @@ func checkMicrosoftDefender() {
|
|||
return
|
||||
}
|
||||
|
||||
elevator := filepath.Join(util.WorkingDir, "elevator.exe")
|
||||
if "dev" == util.Mode || !gulu.File.IsExist(elevator) {
|
||||
elevator = filepath.Join(util.WorkingDir, "elevator", "elevator-"+runtime.GOARCH+".exe")
|
||||
}
|
||||
|
||||
elevator := getElevatorBin()
|
||||
if !gulu.File.IsExist(elevator) {
|
||||
logging.LogWarnf("not found elevator [%s]", elevator)
|
||||
return
|
||||
|
|
@ -137,3 +134,11 @@ func isAdmin() bool {
|
|||
_, err := os.Open("\\\\.\\PHYSICALDRIVE0")
|
||||
return err == nil
|
||||
}
|
||||
|
||||
func getElevatorBin() string {
|
||||
elevator := filepath.Join(util.WorkingDir, "kernel", "elevator.exe")
|
||||
if "dev" == util.Mode || !gulu.File.IsExist(elevator) {
|
||||
elevator = filepath.Join(util.WorkingDir, "elevator", "elevator-"+runtime.GOARCH+".exe")
|
||||
}
|
||||
return elevator
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue