From f62db0100ed3c16acb51a5298ff609b3209e1f89 Mon Sep 17 00:00:00 2001 From: ruibaby Date: Thu, 21 Mar 2019 14:15:04 +0800 Subject: [PATCH] Complete ThemeUtils#isThemeExist --- .../java/cc/ryanc/halo/utils/ThemeUtils.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/main/java/cc/ryanc/halo/utils/ThemeUtils.java b/src/main/java/cc/ryanc/halo/utils/ThemeUtils.java index f2c8c508b..08ca12e34 100644 --- a/src/main/java/cc/ryanc/halo/utils/ThemeUtils.java +++ b/src/main/java/cc/ryanc/halo/utils/ThemeUtils.java @@ -184,6 +184,22 @@ public class ThemeUtils { return result; } + /** + * Judging whether theme exists under template path + * + * @param theme theme name + * @return boolean + * @throws FileNotFoundException FileNotFoundException + */ + public static boolean isThemeExist(String theme) throws FileNotFoundException { + boolean result = false; + File file = new File(getThemesPath(theme), theme); + if (file.exists()) { + result = true; + } + return result; + } + /** * Judging whether the theme is a internal theme or not *