Fixed the problem that copying the default theme at halo startup did not use themeId as the theme folder name (#1549)

* fix: 1547

* refactor: replace the string magic value using a static constant
pull/1564/head
guqing 2021-12-03 10:21:55 +08:00 committed by GitHub
parent 603c4c6eee
commit 9801bc7a20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -165,10 +165,10 @@ public class StartedListener implements ApplicationListener<ApplicationStartedEv
} }
// Create theme folder // Create theme folder
Path themePath = themeService.getBasePath(); Path themePath = themeService.getBasePath().resolve(HaloConst.DEFAULT_THEME_ID);
if (themeService.fetchThemePropertyBy(HaloConst.DEFAULT_THEME_ID).isEmpty()) { if (themeService.fetchThemePropertyBy(HaloConst.DEFAULT_THEME_ID).isEmpty()) {
FileUtils.copyFolder(source, themePath); FileUtils.copyFolder(source.resolve(HaloConst.DEFAULT_THEME_DIR_NAME), themePath);
log.info("Copied theme folder from [{}] to [{}]", source, themePath); log.info("Copied theme folder from [{}] to [{}]", source, themePath);
} }
} catch (Exception e) { } catch (Exception e) {

View File

@ -48,6 +48,11 @@ public class HaloConst {
*/ */
public static final String DEFAULT_THEME_ID = "caicai_anatole"; public static final String DEFAULT_THEME_ID = "caicai_anatole";
/**
* Default theme directory name.
*/
public static final String DEFAULT_THEME_DIR_NAME = "anatole";
/** /**
* Default error path. * Default error path.
*/ */