From 72f8d94b8e8103d2c8f827da4bba6b93c750cf1e Mon Sep 17 00:00:00 2001 From: "Gregory.Shrago" Date: Tue, 7 Apr 2015 21:44:54 +0300 Subject: [PATCH] support windows file paths: c:\xxx --- .../com/intellij/openapi/wm/impl/PaintersHelper.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/PaintersHelper.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/PaintersHelper.java index 4500187d8637..7260c99b5461 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/PaintersHelper.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/PaintersHelper.java @@ -20,8 +20,8 @@ import com.intellij.openapi.ui.AbstractPainter; import com.intellij.openapi.ui.GraphicsConfig; import com.intellij.openapi.ui.Painter; import com.intellij.openapi.util.Comparing; +import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.text.StringUtil; -import com.intellij.openapi.vfs.VfsUtilCore; import com.intellij.util.ImageLoader; import com.intellij.util.containers.ContainerUtil; import com.intellij.util.ui.JBUI; @@ -32,6 +32,7 @@ import org.jetbrains.annotations.Nullable; import javax.swing.*; import java.awt.*; import java.awt.image.VolatileImage; +import java.io.File; import java.net.URL; import java.util.Locale; import java.util.Map; @@ -144,10 +145,13 @@ final class PaintersHelper implements Painter.Listener { catch (IllegalArgumentException e) { fillType = FillType.SCALE; } - String url = parts[0].contains("://")? parts[0] : - VfsUtilCore.pathToUrl(parts[0].contains("/") ? parts[0] : PathManager.getConfigPath() + "/" + parts[0]); + String filePath = parts[0]; - image = ImageLoader.loadFromUrl(new URL(url)); + URL url = filePath.contains("://") ? new URL(filePath) : + (FileUtil.isAbsolutePlatformIndependent(filePath) + ? new File(filePath) + : new File(PathManager.getConfigPath(), filePath)).toURI().toURL(); + image = ImageLoader.loadFromUrl(url); } catch (Exception ignored) { }