mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[platform] restores prematurely deleted API (PY-16928)
This commit is contained in:
+24
@@ -16,9 +16,13 @@
|
||||
package com.intellij.execution.configurations;
|
||||
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.vfs.encoding.EncodingManager;
|
||||
import com.intellij.openapi.vfs.encoding.EncodingProjectManager;
|
||||
import com.intellij.util.EnvironmentUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.Locale;
|
||||
@@ -86,4 +90,24 @@ public class EncodingEnvironmentUtil {
|
||||
private static boolean isLocaleDefined(@NotNull Map<String, String> env) {
|
||||
return env.containsKey(LC_ALL) || env.containsKey(LC_CTYPE) || env.containsKey(LANG);
|
||||
}
|
||||
|
||||
/** @deprecated use {@link #setLocaleEnvironmentIfMac(GeneralCommandLine)} instead (to be removed in IDEA 16) */
|
||||
@SuppressWarnings("unused")
|
||||
public static void fixDefaultEncodingIfMac(@NotNull GeneralCommandLine commandLine, @Nullable Project project) {
|
||||
if (SystemInfo.isMac && !isLocaleDefined(commandLine)) {
|
||||
setLocaleEnvironment(commandLine.getEnvironment(), getCharset(project));
|
||||
}
|
||||
}
|
||||
|
||||
/** @deprecated use {@link #setLocaleEnvironmentIfMac(Map, Charset)} instead (to be removed in IDEA 15) */
|
||||
@SuppressWarnings("unused")
|
||||
public static void fixDefaultEncodingIfMac(@NotNull Map<String, String> env, @Nullable Project project) {
|
||||
if (SystemInfo.isMac && !isLocaleDefined(env)) {
|
||||
setLocaleEnvironment(env, getCharset(project));
|
||||
}
|
||||
}
|
||||
|
||||
private static Charset getCharset(Project project) {
|
||||
return (project != null ? EncodingProjectManager.getInstance(project) : EncodingManager.getInstance()).getDefaultCharset();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user