From 01e9dae8db9cb75a11e478e02caa27a98ef91092 Mon Sep 17 00:00:00 2001 From: "Maxim.Mossienko" Date: Fri, 29 Jun 2012 15:11:23 +0400 Subject: [PATCH] for temp file system load image content directly, as we now have ImageInfoIndex working without vfs --- .../src/org/intellij/images/index/ImageInfoIndex.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/images/src/org/intellij/images/index/ImageInfoIndex.java b/images/src/org/intellij/images/index/ImageInfoIndex.java index c92a0ccc71a0..b87e58a0906e 100644 --- a/images/src/org/intellij/images/index/ImageInfoIndex.java +++ b/images/src/org/intellij/images/index/ImageInfoIndex.java @@ -62,7 +62,16 @@ public class ImageInfoIndex extends SingleEntryFileBasedIndexExtension myDataIndexer = new SingleEntryIndexer(false) { @Override protected ImageInfo computeValue(@NotNull FileContent inputData) { - final ImageInfoReader.Info info = ImageInfoReader.getInfo(inputData.getFile().getPath()); + VirtualFile file = inputData.getFile(); + final ImageInfoReader.Info info; + if (file.getFileSystem() == TempFileSystem.getInstance()) { // for tests load content directly as we are now not requiring content index + try { + info = ImageInfoReader.getInfo(file.contentsToByteArray()); + } catch (IOException ex) { return null; } + } + else { + info = ImageInfoReader.getInfo(file.getPath()); + } return info != null? new ImageInfo(info.width, info.height, info.bpp) : null; } };