{
iconFile = (((SwcScript) source.getOwner()).getLibrary().getSwc().getFile(swcIcon));
if (iconFile != null)
{
// we then put the resolved file into an InMemoryFile so that we can changed its name
VirtualFile inMemFile = new InMemoryFile(iconFile.getInputStream(), swcIcon,
MimeMappings.getMimeType(swcIcon),
iconFile.getLastModified());
archive.putFile( inMemFile );
return;
}
}
}
}
// It seems like this will never be true, because if
// the icon was missing when the original SWC was
// created, a MissingIconFile would have been thrown.
if (iconFile == null)
{
return;
}
}
if (iconFile == null)
{
throw new SwcException.MissingIconFile(unit.icon, sourceName);
}
// yes using both toDot and toColon here feels very wacky
String workingSourceName = NameFormatter.toColon(NameFormatter.toDot(sourceName, '/'));
SwcComponent comp = components.get(workingSourceName);
String rel = source.getRelativePath();
String iconName = (rel == null || rel.length() == 0) ? unit.icon : rel + "/" + unit.icon;
if (comp != null)
{
comp.setIcon(iconName);
}
// we then put the resolved file into an InMemoryFile so that we can changed its name
VirtualFile inMemFile = new InMemoryFile(iconFile.getInputStream(), iconName,
MimeMappings.getMimeType(iconName),
iconFile.getLastModified());
archive.putFile( inMemFile );
}
}