Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pref: init default theme. #1297

Merged
merged 1 commit into from
Mar 5, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/main/java/run/halo/app/listener/StartedListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,11 @@ private void initThemes() {
// Whether the blog has initialized
Boolean isInstalled = optionService
.getByPropertyOrDefault(PrimaryProperties.IS_INSTALLED, Boolean.class, false);

if (isInstalled) {
return;
}

try {
String themeClassPath = ResourceUtils.CLASSPATH_URL_PREFIX + ThemeService.THEME_FOLDER;

Expand All @@ -163,7 +168,7 @@ private void initThemes() {
Path themePath = themeService.getBasePath();

// Fix the problem that the project cannot start after moving to a new server
if (!haloProperties.isProductionEnv() || Files.notExists(themePath) || !isInstalled) {
if (!haloProperties.isProductionEnv() || Files.notExists(themePath)) {
FileUtils.copyFolder(source, themePath);
log.debug("Copied theme folder from [{}] to [{}]", source, themePath);
} else {
Expand Down