1
0
mirror of https://github.com/chylex/IntelliJ-Colored-Icons.git synced 2025-05-01 10:34:06 +02:00

Force LF line endings & fix code inspections

This commit is contained in:
chylex 2020-09-03 11:16:30 +02:00
parent 9edd8374a3
commit 7f898593c1
3 changed files with 16 additions and 15 deletions
.gitattributes
src/com/chylex/intellij/coloredicons

1
.gitattributes vendored Normal file
View File

@ -0,0 +1 @@
* text=auto eol=lf

View File

@ -11,20 +11,20 @@ import java.util.Set;
final class BuildHelpers{ final class BuildHelpers{
static final class FixSVG{ static final class FixSVG{
public static void main(String[] args) throws IOException{ public static void main(final String[] args) throws IOException{
Charset charset = StandardCharsets.UTF_8; final Charset charset = StandardCharsets.UTF_8;
String encoding = charset.name(); final String encoding = charset.name();
String svg12Tag = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\" viewBox=\"0 0 12 12\">"; final String svg12Tag = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\" viewBox=\"0 0 12 12\">";
String svg13Tag = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"13\" height=\"13\" viewBox=\"0 0 13 13\">"; final String svg13Tag = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"13\" height=\"13\" viewBox=\"0 0 13 13\">";
String svg16Tag = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\">"; final String svg16Tag = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\">";
Set<String> svgTags = new HashSet<>(Arrays.asList( final Set<String> svgTags = new HashSet<>(Arrays.asList(
svg12Tag, svg13Tag, svg16Tag svg12Tag, svg13Tag, svg16Tag
)); ));
for(File file : FileUtils.listFiles(new File("./resources/icons"), new String[]{ "svg" }, true)){ for(final File file : FileUtils.listFiles(new File("./resources/icons"), new String[]{ "svg" }, true)){
List<String> lines = FileUtils.readLines(file, charset); final List<String> lines = FileUtils.readLines(file, charset);
if (lines.get(0).startsWith("<?xml")){ if (lines.get(0).startsWith("<?xml")){
lines.remove(0); lines.remove(0);
@ -34,7 +34,7 @@ final class BuildHelpers{
lines.remove(0); lines.remove(0);
} }
String svg = lines.get(0); final String svg = lines.get(0);
if (svg.startsWith("<svg width=\"100%\" height=\"100%\" viewBox=\"0 0 13 13\"")){ if (svg.startsWith("<svg width=\"100%\" height=\"100%\" viewBox=\"0 0 13 13\"")){
lines.set(0, svg13Tag); lines.set(0, svg13Tag);

View File

@ -114,20 +114,20 @@ public class IconPatcher extends IconPathPatcher{
IconLoader.installPathPatcher(this); IconLoader.installPathPatcher(this);
} }
private void addPathWithDark(String path){ private void addPathWithDark(final String path){
iconPaths.put("/" + path + ".svg", "/icons/" + path + ".svg"); iconPaths.put('/' + path + ".svg", "/icons/" + path + ".svg");
iconPaths.put("/" + path + "_dark.svg", "/icons/" + path + "_dark.svg"); iconPaths.put('/' + path + "_dark.svg", "/icons/" + path + "_dark.svg");
} }
@Nullable @Nullable
@Override @Override
public String patchPath(@NotNull String path, ClassLoader classLoader){ public String patchPath(@NotNull final String path, final ClassLoader classLoaderIgnore){
return iconPaths.get(path); return iconPaths.get(path);
} }
@Nullable @Nullable
@Override @Override
public ClassLoader getContextClassLoader(@NotNull String path, ClassLoader originalClassLoader){ public ClassLoader getContextClassLoader(@NotNull final String path, final ClassLoader originalClassLoader){
return classLoader; return classLoader;
} }
} }