Beauty initThemes

pull/137/head
johnniang 2019-03-26 22:08:57 +08:00
parent 39407aa8cf
commit 7052c3ccf7
1 changed files with 13 additions and 10 deletions

View File

@ -142,20 +142,23 @@ public class StartedListener implements ApplicationListener<ApplicationStartedEv
* Init internal themes * Init internal themes
*/ */
private void initThemes() { private void initThemes() {
// Whether the blog is initialized // Whether the blog has initialized
Boolean isInstall = optionService.getByProperty(BlogProperties.IS_INSTALL, Boolean.class, false); Boolean isInstalled = optionService.getByProperty(BlogProperties.IS_INSTALL, Boolean.class, false);
try { try {
if (!isInstall) { if (isInstalled) {
File internalThemePath = new File(ResourceUtils.getURL("classpath:").getPath(), "templates/themes"); // Skip
File[] internalThemes = internalThemePath.listFiles(); return;
if (null != internalThemes) { }
for (File theme : internalThemes) {
FileUtil.copy(theme, themeService.getThemeBasePath(), true); File internalThemePath = new File(ResourceUtils.getURL(ResourceUtils.CLASSPATH_URL_PREFIX).getPath(), "templates/themes");
} File[] internalThemes = internalThemePath.listFiles();
if (null != internalThemes) {
for (File theme : internalThemes) {
FileUtil.copy(theme, themeService.getThemeBasePath(), true);
} }
} }
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException("Init internal theme to user path error"); throw new RuntimeException("Init internal theme to user path error", e);
} }
} }
} }