Refactor ThemeService.

pull/146/head
ruibaby 2019-04-08 21:58:13 +08:00
parent 21c39ac33a
commit c72934f671
1 changed files with 10 additions and 2 deletions

View File

@ -95,8 +95,16 @@ public class ThemeServiceImpl implements ThemeService {
} }
theme = new Theme(); theme = new Theme();
theme.setKey(file.getName()); theme.setKey(file.getName());
File optionsPath = new File(file.getAbsolutePath(), "module/options.ftl"); theme.setHasOptions(false);
theme.setHasOptions(optionsPath.exists()); for (String optionsName : OPTIONS_NAMES) {
// Resolve the options path
Path optionsPath = workDir.resolve(file.getName()).resolve(optionsName);
if (!Files.exists(optionsPath)) {
continue;
}
theme.setHasOptions(true);
}
theme.setProperties(getProperties(new File(getThemeBasePath(), file.getName()))); theme.setProperties(getProperties(new File(getThemeBasePath(), file.getName())));
themes.add(theme); themes.add(theme);
} }