From 7bed63cea5a894956d98351adbb437ab9643f079 Mon Sep 17 00:00:00 2001 From: ful1e5 <24286590+ful1e5@users.noreply.github.com> Date: Thu, 12 Nov 2020 10:31:18 +0530 Subject: [PATCH] =?UTF-8?q?=F0=9F=8C=88=20semi-animated=20svg=20messsages?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/core/src/SvgHandler/SvgDirectoryParser.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/core/src/SvgHandler/SvgDirectoryParser.ts b/packages/core/src/SvgHandler/SvgDirectoryParser.ts index 52c71d7f..27afa502 100644 --- a/packages/core/src/SvgHandler/SvgDirectoryParser.ts +++ b/packages/core/src/SvgHandler/SvgDirectoryParser.ts @@ -6,6 +6,7 @@ export default class SvgDirectoryParser { * Parse the `.svg` files directory. * @param svgDir is relative/absolute path, Where source `.svg` files are stored. */ + semiAnimated: boolean = false; constructor(private svgDir: string) { if (!fs.existsSync(this.svgDir)) { throw new Error(`🚨 .svg files not found in ${this.svgDir}`); @@ -28,6 +29,9 @@ export default class SvgDirectoryParser { if (staticCursors.length == 0) { console.warn("Static Cursors directory is empty"); + + console.log("Considering as semi-animated theme"); + this.semiAnimated = true; } return staticCursors; @@ -47,7 +51,11 @@ export default class SvgDirectoryParser { .readdirSync(cursorDir) .map((f) => path.resolve(cursorDir, f)); - if (animatedCursors.length == 0) { + if (animatedCursors.length == 0 && this.semiAnimated) { + throw new Error( + `🚨 Can't parse svg directory ${this.svgDir} as semi-animated cursors` + ); + } else { console.warn("Animated Cursors directory is empty"); }