From 5489338982a73ba8a93c43b2d5366f4b9c191acd Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Wed, 5 Apr 2017 18:34:03 +0200 Subject: [PATCH] Cleanup (obsolete OS constant) --- .../src/com/intellij/openapi/vfs/VfsUtilCore.java | 4 ++-- .../openapi/vfs/impl/local/LocalFileSystemBase.java | 7 +++---- .../src/com/intellij/openapi/util/SystemInfoRt.java | 10 +++++++--- .../util/src/com/intellij/openapi/util/SystemInfo.java | 4 +++- .../com/jetbrains/python/buildout/BuildoutFacet.java | 2 +- python/src/com/jetbrains/python/sdk/PythonSdkType.java | 2 +- 6 files changed, 17 insertions(+), 12 deletions(-) diff --git a/platform/core-api/src/com/intellij/openapi/vfs/VfsUtilCore.java b/platform/core-api/src/com/intellij/openapi/vfs/VfsUtilCore.java index 6e0b38c3bb6a..fd21a442916e 100644 --- a/platform/core-api/src/com/intellij/openapi/vfs/VfsUtilCore.java +++ b/platform/core-api/src/com/intellij/openapi/vfs/VfsUtilCore.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2016 JetBrains s.r.o. + * Copyright 2000-2017 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -467,7 +467,7 @@ public class VfsUtilCore { throw new RuntimeException(new IOException(VfsBundle.message("url.parse.error", url.toExternalForm()))); } } - if (SystemInfo.isWindows || SystemInfo.isOS2) { + if (SystemInfo.isWindows) { while (!path.isEmpty() && path.charAt(0) == '/') { path = path.substring(1, path.length()); } diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/LocalFileSystemBase.java b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/LocalFileSystemBase.java index 0387ca2b2d58..204024bd8595 100644 --- a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/LocalFileSystemBase.java +++ b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/LocalFileSystemBase.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2016 JetBrains s.r.o. + * Copyright 2000-2017 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -72,14 +72,13 @@ public abstract class LocalFileSystemBase extends LocalFileSystem { @Override public VirtualFile findFileByIoFile(@NotNull File file) { - String path = FileUtil.toSystemIndependentName(file.getAbsolutePath()); - return findFileByPath(path); + return findFileByPath(FileUtil.toSystemIndependentName(file.getAbsolutePath())); } @NotNull protected static File convertToIOFile(@NotNull final VirtualFile file) { String path = file.getPath(); - if (StringUtil.endsWithChar(path, ':') && path.length() == 2 && (SystemInfo.isWindows || SystemInfo.isOS2)) { + if (StringUtil.endsWithChar(path, ':') && path.length() == 2 && SystemInfo.isWindows) { path += "/"; // Make 'c:' resolve to a root directory for drive c:, not the current directory on that drive } diff --git a/platform/util-rt/src/com/intellij/openapi/util/SystemInfoRt.java b/platform/util-rt/src/com/intellij/openapi/util/SystemInfoRt.java index 3ed08ab5f207..beba4e3bb270 100644 --- a/platform/util-rt/src/com/intellij/openapi/util/SystemInfoRt.java +++ b/platform/util-rt/src/com/intellij/openapi/util/SystemInfoRt.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2016 JetBrains s.r.o. + * Copyright 2000-2017 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,13 +29,17 @@ public class SystemInfoRt { private static final String _OS_NAME = OS_NAME.toLowerCase(Locale.US); public static final boolean isWindows = _OS_NAME.startsWith("windows"); - public static final boolean isOS2 = _OS_NAME.startsWith("os/2") || _OS_NAME.startsWith("os2"); public static final boolean isMac = _OS_NAME.startsWith("mac"); public static final boolean isLinux = _OS_NAME.startsWith("linux"); public static final boolean isFreeBSD = _OS_NAME.startsWith("freebsd"); public static final boolean isSolaris = _OS_NAME.startsWith("sunos"); - public static final boolean isUnix = !isWindows && !isOS2; + public static final boolean isUnix = !isWindows; public static final boolean isFileSystemCaseSensitive = isUnix && !isMac || "true".equalsIgnoreCase(System.getProperty("idea.case.sensitive.fs")); + + // + /** @deprecated outdated (to be removed in IDEA 2018) */ + public static final boolean isOS2 = _OS_NAME.startsWith("os/2") || _OS_NAME.startsWith("os2"); + // } \ No newline at end of file diff --git a/platform/util/src/com/intellij/openapi/util/SystemInfo.java b/platform/util/src/com/intellij/openapi/util/SystemInfo.java index 3c4f065d0d37..1d1d0c0f5aa4 100644 --- a/platform/util/src/com/intellij/openapi/util/SystemInfo.java +++ b/platform/util/src/com/intellij/openapi/util/SystemInfo.java @@ -37,7 +37,6 @@ public class SystemInfo extends SystemInfoRt { public static final boolean isWindows = SystemInfoRt.isWindows; public static final boolean isMac = SystemInfoRt.isMac; - public static final boolean isOS2 = SystemInfoRt.isOS2; public static final boolean isLinux = SystemInfoRt.isLinux; public static final boolean isFreeBSD = SystemInfoRt.isFreeBSD; public static final boolean isSolaris = SystemInfoRt.isSolaris; @@ -238,5 +237,8 @@ public class SystemInfo extends SystemInfoRt { public static String getUnixReleaseVersion() { return null; } + + /** @deprecated outdated (to be removed in IDEA 2018) */ + public static final boolean isOS2 = SystemInfoRt.isOS2; // } \ No newline at end of file diff --git a/python/src/com/jetbrains/python/buildout/BuildoutFacet.java b/python/src/com/jetbrains/python/buildout/BuildoutFacet.java index bbf307e51716..41464dd71eb2 100644 --- a/python/src/com/jetbrains/python/buildout/BuildoutFacet.java +++ b/python/src/com/jetbrains/python/buildout/BuildoutFacet.java @@ -99,7 +99,7 @@ public class BuildoutFacet extends LibraryContributingFacet