AtomMaterialUI / a-file-icon-idea

Atom Material Icons for JetBrains - Replace File and UI Icons for better visual grepping.
http://www.material-theme.com/docs/configuration/icons-settings/#atom-material-icons-plugin
MIT License
225 stars 28 forks source link

Use separate settings for custom icons for Windows/Linux/MacOS #451

Closed mallowigi closed 3 months ago

mallowigi commented 6 months ago

Discussed in https://github.com/mallowigi/a-file-icon-idea/discussions/254

Originally posted by **SergeyMaltsev** December 23, 2021 **Describe the bug** When I use shared JetBains configuration via git [settings repository](https://www.jetbrains.com/help/idea/sharing-your-ide-settings.html#settings-repository) I have problems with custom Associations for my icons paths. For Windows icon path is something like `C:\Users\User\icons\...` for Mac it could be `~/icons/...`, same for Linux. It resolves in IDE plugin crash. **To Reproduce** 1. Create a shared settings repository and setup custom icons in Windows (for example) 2. Launch IDE on MacOS or Linux 3. Receive an error on IDE start ``` java.io.FileNotFoundException: C:\Users\User\icons\idea-types\js.svg (No such file or directory) at java.base/java.io.FileInputStream.open0(Native Method) at java.base/java.io.FileInputStream.open(FileInputStream.java:219) at java.base/java.io.FileInputStream.(FileInputStream.java:157) at java.base/java.io.FileInputStream.(FileInputStream.java:112) at icons.AtomIcons.loadSVGIcon(AtomIcons.kt:107) at icons.AtomIcons.loadIconWithFallback(AtomIcons.kt:111) at com.mallowigi.icons.providers.DefaultFileIconProvider.getIcon(DefaultFileIconProvider.kt:53) at com.mallowigi.icons.providers.AbstractFileIconProvider.loadIcon(AbstractFileIconProvider.kt:96) at com.mallowigi.icons.providers.AbstractFileIconProvider.getIconForAssociation$lambda-0(AbstractFileIconProvider.kt:88) at java.base/java.util.Optional.map(Optional.java:265) at com.mallowigi.icons.providers.AbstractFileIconProvider.getIconForAssociation(AbstractFileIconProvider.kt:88) at com.mallowigi.icons.providers.AbstractFileIconProvider.findIcon(AbstractFileIconProvider.kt:69) at com.mallowigi.icons.providers.AbstractFileIconProvider.getIcon(AbstractFileIconProvider.kt:52) at com.intellij.util.PsiIconUtil.getProvidersIcon(PsiIconUtil.java:21) at com.intellij.ide.FileIconPatcherImpl.getIcon(FileIconPatcherImpl.java:37) at com.intellij.util.IconUtil.getProvidersIcon(IconUtil.java:222) at com.intellij.util.IconUtil.computeFileIcon(IconUtil.java:155) at com.intellij.openapi.fileEditor.impl.EditorsSplitters.lambda$updateFileIconAsynchronously$7(EditorsSplitters.java:430) at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$Submission.insideReadAction(NonBlockingReadActionImpl.java:521) at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$Submission.lambda$attemptComputation$3(NonBlockingReadActionImpl.java:486) at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1078) at com.intellij.openapi.progress.util.ProgressIndicatorUtils.lambda$runInReadActionWithWriteActionPriority$0(ProgressIndicatorUtils.java:78) at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runActionAndCancelBeforeWrite(ProgressIndicatorUtils.java:161) at com.intellij.openapi.progress.util.ProgressIndicatorUtils.lambda$runWithWriteActionPriority$1(ProgressIndicatorUtils.java:118) at com.intellij.openapi.progress.ProgressManager.lambda$runProcess$0(ProgressManager.java:57) at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:183) at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:705) at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:647) at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:63) at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:170) at com.intellij.openapi.progress.ProgressManager.runProcess(ProgressManager.java:57) at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runWithWriteActionPriority(ProgressIndicatorUtils.java:115) at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runInReadActionWithWriteActionPriority(ProgressIndicatorUtils.java:78) at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$Submission.attemptComputation(NonBlockingReadActionImpl.java:486) at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$Submission.lambda$transferToBgThread$1(NonBlockingReadActionImpl.java:407) at com.intellij.util.concurrency.BoundedTaskExecutor.doRun(BoundedTaskExecutor.java:216) at com.intellij.util.concurrency.BoundedTaskExecutor.access$200(BoundedTaskExecutor.java:27) at com.intellij.util.concurrency.BoundedTaskExecutor$1.execute(BoundedTaskExecutor.java:195) at com.intellij.util.concurrency.BoundedTaskExecutor$1.run(BoundedTaskExecutor.java:187) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668) at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665) at java.base/java.lang.Thread.run(Thread.java:829) ``` **Expected Behavior** No error should occur. I suppose plugin should have separate settings for icons based on OS. Best If I could set root folder per OS and Icons Associations would have relative paths to not recreate all from scratch for each OS. **Environment** * OS (Windows, Linux, Mac) * IntelliJ Product: any * Plugin version: 50.2.0 **Screenshots** ![image](https://user-images.githubusercontent.com/57486330/147203639-191a1e77-bc82-42ee-85f2-60ade1ea7877.png)