diff --git a/platform/platform-impl/src/com/intellij/execution/wsl/WSLUtil.java b/platform/platform-impl/src/com/intellij/execution/wsl/WSLUtil.java index 8100c2aa7441..940f5f639f53 100644 --- a/platform/platform-impl/src/com/intellij/execution/wsl/WSLUtil.java +++ b/platform/platform-impl/src/com/intellij/execution/wsl/WSLUtil.java @@ -69,7 +69,7 @@ public final class WSLUtil { * @return root for WSL executable or null if unavailable */ private static @Nullable Path getExecutableRootPath() { - String localAppDataPath = System.getenv().get("LOCALAPPDATA"); + String localAppDataPath = System.getenv("LOCALAPPDATA"); return StringUtil.isEmpty(localAppDataPath) ? null : Paths.get(localAppDataPath, "Microsoft\\WindowsApps"); } diff --git a/platform/warmup/src/com/intellij/warmup/ProjectCachesWarmup.kt b/platform/warmup/src/com/intellij/warmup/ProjectCachesWarmup.kt index c48b326e8118..6fdf35e9d322 100644 --- a/platform/warmup/src/com/intellij/warmup/ProjectCachesWarmup.kt +++ b/platform/warmup/src/com/intellij/warmup/ProjectCachesWarmup.kt @@ -1,4 +1,4 @@ -// Copyright 2000-2023 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.warmup import com.intellij.ide.environment.impl.EnvironmentUtil @@ -217,7 +217,7 @@ private fun parseCommandLineArguments(args: List): WarmupProjectArgs { private suspend fun buildProject(project: Project, commandArgs: WarmupProjectArgs) { val buildMode = getBuildMode(commandArgs) - val builders = System.getenv()["IJ_WARMUP_BUILD_BUILDERS"]?.split(";")?.toHashSet() + val builders = System.getenv("IJ_WARMUP_BUILD_BUILDERS")?.split(";")?.toHashSet() if (buildMode != null) { waitForBuilders(project, buildMode, builders) } @@ -259,4 +259,3 @@ private suspend fun exitApplication() { ApplicationManager.getApplication().exit(false, true, false) } } - diff --git a/plugins/ide-startup/importSettings/src/com/intellij/ide/startup/importSettings/transfer/backend/db/WindowsEnvVariables.kt b/plugins/ide-startup/importSettings/src/com/intellij/ide/startup/importSettings/transfer/backend/db/WindowsEnvVariables.kt index 061f524e0bc4..dc15068fbca5 100644 --- a/plugins/ide-startup/importSettings/src/com/intellij/ide/startup/importSettings/transfer/backend/db/WindowsEnvVariables.kt +++ b/plugins/ide-startup/importSettings/src/com/intellij/ide/startup/importSettings/transfer/backend/db/WindowsEnvVariables.kt @@ -1,23 +1,17 @@ -// Copyright 2000-2023 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.ide.startup.importSettings.db import com.intellij.ide.startup.importSettings.providers.vswin.utilities.RunConfigurationEnvironmentUtils -import java.util.* +import com.intellij.util.EnvironmentUtil object WindowsEnvVariables { /* - * Some widely used env vars. - */ - val applicationData: String = get("APPDATA").toString() - val localApplicationData: String = get("LOCALAPPDATA").toString() - val userProfile: String = get("USERPROFILE").toString() - - /** - * Function to get one Windows env var. - * - * Use without %%. Example: get("APPDATA") + * Some widely used env vars. */ - fun get(variable: String): String? = System.getenv()[variable] ?: System.getenv()[variable.uppercase(Locale.getDefault())] + val applicationData: String = EnvironmentUtil.getValue("APPDATA").toString() + val localApplicationData: String = EnvironmentUtil.getValue("LOCALAPPDATA").toString() + val userProfile: String = EnvironmentUtil.getValue("USERPROFILE").toString() - fun expandPath(path: String): String? = RunConfigurationEnvironmentUtils.expandVariables("%", "%", path, WindowsEnvVariables::get, false, null) -} \ No newline at end of file + fun expandPath(path: String): String? = + RunConfigurationEnvironmentUtils.expandVariables("%", "%", path, EnvironmentUtil::getValue, false, null) +} diff --git a/python/build/build-debug-binaries/src/build.gradle b/python/build/build-debug-binaries/src/build.gradle index 6e8c7f7771ac..5122a27ad03f 100644 --- a/python/build/build-debug-binaries/src/build.gradle +++ b/python/build/build-debug-binaries/src/build.gradle @@ -26,7 +26,7 @@ envs { String python312version = "3.12.0" String python313version = "3.13.0" - def customBuildDir = System.getenv().get("PYCHARM_BUILD_DIR") + def customBuildDir = System.getenv("PYCHARM_BUILD_DIR") project.buildDir = customBuildDir? new File(customBuildDir): buildDir bootstrapDirectory = new File(buildDir, 'pythons') envsDirectory = new File(buildDir, 'envs') diff --git a/python/python-psi-impl/src/com/jetbrains/python/psi/PyUtil.java b/python/python-psi-impl/src/com/jetbrains/python/psi/PyUtil.java index 3924373d8eee..13389249c405 100644 --- a/python/python-psi-impl/src/com/jetbrains/python/psi/PyUtil.java +++ b/python/python-psi-impl/src/com/jetbrains/python/psi/PyUtil.java @@ -73,7 +73,7 @@ import static com.jetbrains.python.ast.PyAstFunction.Modifier.STATICMETHOD; */ public final class PyUtil { - private static final boolean VERBOSE_MODE = System.getenv().get("_PYCHARM_VERBOSE_MODE") != null; + private static final boolean VERBOSE_MODE = System.getenv("_PYCHARM_VERBOSE_MODE") != null; private PyUtil() { } diff --git a/python/tools/setup-conda-envs/build.gradle b/python/tools/setup-conda-envs/build.gradle index ae683a295751..5559e1fad836 100644 --- a/python/tools/setup-conda-envs/build.gradle +++ b/python/tools/setup-conda-envs/build.gradle @@ -12,7 +12,7 @@ envs { envsDirectory = new File(System.getenv().getOrDefault("PYCHARM_PYTHON_VIRTUAL_ENVS", new File(buildDir, 'envs').path)) if (System.getenv().containsKey("PYCHARM_ZIP_REPOSITORY")) { - zipRepository = new URL(System.getenv().get("PYCHARM_ZIP_REPOSITORY")) + zipRepository = new URL(System.getenv("PYCHARM_ZIP_REPOSITORY")) shouldUseZipsFromRepository = Os.isFamily(Os.FAMILY_WINDOWS) } diff --git a/python/tools/setup-envs/build.gradle b/python/tools/setup-envs/build.gradle index 587f39891e7b..4ffe0cebb443 100644 --- a/python/tools/setup-envs/build.gradle +++ b/python/tools/setup-envs/build.gradle @@ -26,7 +26,7 @@ envs { envsDirectory = new File(System.getenv().getOrDefault("PYCHARM_PYTHON_VIRTUAL_ENVS", new File(buildDir, 'envs').path)) if (System.getenv().containsKey("PYCHARM_ZIP_REPOSITORY")) { - zipRepository = new URL(System.getenv().get("PYCHARM_ZIP_REPOSITORY")) + zipRepository = new URL(System.getenv("PYCHARM_ZIP_REPOSITORY")) shouldUseZipsFromRepository = Os.isFamily(Os.FAMILY_WINDOWS) }