diff --git a/.circleci/config.yml b/.circleci/config.yml index e9e4452ea17..f140a5511af 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -6,6 +6,8 @@ jobs: - image: circleci/openjdk:8-jdk steps: - checkout + - run: git submodule sync + - run: git submodule update --init - restore_cache: keys: - install4j-{{ checksum "scripts/extract-install4j.sh" }} @@ -26,6 +28,8 @@ jobs: - restore_cache: key: dependency-cache - checkout + - run: git submodule sync + - run: git submodule update --init - restore_cache: key: install4j-{{ checksum "scripts/extract-install4j.sh" }} - run: scripts/extract-install4j.sh @@ -47,6 +51,8 @@ jobs: - restore_cache: key: dependency-cache - checkout + - run: git submodule sync + - run: git submodule update --init - restore_cache: key: install4j-{{ checksum "scripts/extract-install4j.sh" }} - run: scripts/extract-install4j.sh diff --git a/src/main/java/org/jabref/gui/util/ThemeLoader.java b/src/main/java/org/jabref/gui/util/ThemeLoader.java index b2230505578..d7d452e2b3e 100644 --- a/src/main/java/org/jabref/gui/util/ThemeLoader.java +++ b/src/main/java/org/jabref/gui/util/ThemeLoader.java @@ -2,9 +2,9 @@ import java.io.IOException; import java.net.MalformedURLException; +import java.net.URI; import java.net.URISyntaxException; import java.net.URL; -import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.Objects; @@ -73,7 +73,6 @@ public ThemeLoader(FileUpdateMonitor fileUpdateMonitor, JabRefPreferences jabRef } } - /** * Installs the base css file as a stylesheet in the given scene. Changes in the css file lead to a redraw of the * scene using the new css file. @@ -89,18 +88,23 @@ private void addAndWatchForChanges(Scene scene, URL cssFile, int index) { scene.getStylesheets().add(index, cssFile.toExternalForm()); try { - // If the file is an ordinary file (i.e. not a resource part of a .jar bundle), we watch it for changes and turn on live reloading - Path cssPath = Paths.get(cssFile.toURI()); - if (Files.isRegularFile(cssPath)) { - LOGGER.info("Enabling live reloading of " + cssPath); - fileUpdateMonitor.addListenerForFile(cssPath, () -> { - LOGGER.info("Reload css file " + cssFile); - DefaultTaskExecutor.runInJavaFXThread(() -> { - scene.getStylesheets().remove(cssFile.toExternalForm()); - scene.getStylesheets().add(index, cssFile.toExternalForm()); - } - ); - }); + + URI cssUri = cssFile.toURI(); + if (!cssUri.toString().contains("jar")) { + LOGGER.debug("CSS URI {}", cssUri); + + Path cssPath = Paths.get(cssUri).toAbsolutePath(); + // If the file is an ordinary file (i.e. not a resource part of a .jar bundle), we watch it for changes and turn on live reloading + if (!cssUri.toString().contains("jar")) { + LOGGER.info("Enabling live reloading of {}", cssPath); + fileUpdateMonitor.addListenerForFile(cssPath, () -> { + LOGGER.info("Reload css file " + cssFile); + DefaultTaskExecutor.runInJavaFXThread(() -> { + scene.getStylesheets().remove(cssFile.toExternalForm()); + scene.getStylesheets().add(index, cssFile.toExternalForm()); + }); + }); + } } } catch (IOException | URISyntaxException e) { LOGGER.error("Could not watch css file for changes " + cssFile, e);