From a8b46abe0c1eefe163a6243af4eb8a0d6e27ebb2 Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Thu, 20 Nov 2025 09:27:16 +0100 Subject: [PATCH] cleanup [platform]: obsolete API; suppressions; formatting GitOrigin-RevId: 9cf21a9ebc2bc39b25e978c92a74333eea489598 --- .../diagnostic/ResetWindowsDefenderNotification.kt | 13 ++++++------- .../intellij/diagnostic/WindowsDefenderChecker.java | 5 +++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/diagnostic/ResetWindowsDefenderNotification.kt b/platform/platform-impl/src/com/intellij/diagnostic/ResetWindowsDefenderNotification.kt index 3008b5cf25f4..b3f2f3f90350 100644 --- a/platform/platform-impl/src/com/intellij/diagnostic/ResetWindowsDefenderNotification.kt +++ b/platform/platform-impl/src/com/intellij/diagnostic/ResetWindowsDefenderNotification.kt @@ -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().coroutineScope.launch { val checker = serviceAsync() - 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) } } diff --git a/platform/platform-impl/src/com/intellij/diagnostic/WindowsDefenderChecker.java b/platform/platform-impl/src/com/intellij/diagnostic/WindowsDefenderChecker.java index 9bef7107937b..6695006cbc6a 100644 --- a/platform/platform-impl/src/com/intellij/diagnostic/WindowsDefenderChecker.java +++ b/platform/platform-impl/src/com/intellij/diagnostic/WindowsDefenderChecker.java @@ -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());