mirror of https://github.com/halo-dev/halo
Beauty initThemes
parent
39407aa8cf
commit
7052c3ccf7
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue