cleanup [platform]: obsolete API; suppressions; formatting

GitOrigin-RevId: 9cf21a9ebc2bc39b25e978c92a74333eea489598
This commit is contained in:
Roman Shevchenko
2025-11-20 10:42:52 +00:00
committed by intellij-monorepo-bot
parent 0d10bbfa78
commit a8b46abe0c
2 changed files with 9 additions and 9 deletions
@@ -1,4 +1,4 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.diagnostic
import com.intellij.openapi.actionSystem.ActionUpdateThread
@@ -6,24 +6,23 @@ import com.intellij.openapi.actionSystem.AnAction
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.components.service
import com.intellij.openapi.components.serviceAsync
import com.intellij.openapi.util.SystemInfo
import com.intellij.platform.ide.CoreUiCoroutineScopeHolder
import com.intellij.util.system.OS
import kotlinx.coroutines.launch
private class ResetWindowsDefenderNotification : AnAction() {
override fun getActionUpdateThread() = ActionUpdateThread.BGT
override fun update(e: AnActionEvent) {
e.presentation.isEnabledAndVisible = SystemInfo.isWindows
e.presentation.isEnabledAndVisible = OS.CURRENT == OS.Windows
}
override fun actionPerformed(e: AnActionEvent) {
service<CoreUiCoroutineScopeHolder>().coroutineScope.launch {
val checker = serviceAsync<WindowsDefenderChecker>()
checker.ignoreStatusCheck(null, false)
val project = e.project
if (project != null) {
checker.ignoreStatusCheck(project, false)
checker.ignoreStatusCheck(/*project =*/ null, /*ignore =*/ false)
e.project?.let { project ->
checker.ignoreStatusCheck(project, /*ignore =*/ false)
WindowsDefenderCheckerActivity().execute(project)
}
}
@@ -309,7 +309,7 @@ public class WindowsDefenderChecker {
try {
var script = PathManager.findBinFile(HELPER_SCRIPT_NAME);
if (script == null) {
LOG.info("'" + HELPER_SCRIPT_NAME + "' is missing from '" + PathManager.getBinPath() + "'");
LOG.info("'" + HELPER_SCRIPT_NAME + "' is missing from '" + PathManager.getBinDir() + "'");
return false;
}
@@ -374,8 +374,9 @@ public class WindowsDefenderChecker {
}
}
@SuppressWarnings("IO_FILE_USAGE")
private static ProcessOutput run(ProcessBuilder command, Charset charset) throws IOException {
var tempDir = NioFiles.createDirectories(Path.of(PathManager.getTempPath()));
var tempDir = NioFiles.createDirectories(PathManager.getTempDir());
command.environment().put("PSModulePath", "");
command.redirectErrorStream(true);
command.directory(tempDir.toFile());