From 218c1a5a50bf40c080c47909185f9902aaee26f7 Mon Sep 17 00:00:00 2001 From: Waldemar Reusch Date: Thu, 30 Mar 2023 22:13:32 +0200 Subject: [PATCH] refactor: use path.sep to be cross-platform --- scripts/generate-i18n-messages.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/scripts/generate-i18n-messages.ts b/scripts/generate-i18n-messages.ts index 4cebc755..4e83143c 100644 --- a/scripts/generate-i18n-messages.ts +++ b/scripts/generate-i18n-messages.ts @@ -1,6 +1,6 @@ import "minimal-polyfills/Object.fromEntries"; import * as fs from "fs"; -import { join as pathJoin, relative as pathRelative, dirname as pathDirname } from "path"; +import { join as pathJoin, relative as pathRelative, dirname as pathDirname, sep as pathSep } from "path"; import { crawl } from "../src/bin/tools/crawl"; import { downloadBuiltinKeycloakTheme } from "../src/bin/download-builtin-keycloak-theme"; import { getProjectRoot } from "../src/bin/tools/getProjectRoot"; @@ -35,11 +35,10 @@ async function main() { { const baseThemeDirPath = pathJoin(tmpDirPath, "base"); + const re = new RegExp(`^([^\\${pathSep}]+)\\${pathSep}messages\\${pathSep}messages_([^.]+).properties$`); crawl(baseThemeDirPath).forEach(filePath => { - const match = - filePath.match(/^([^/]+)\/messages\/messages_([^.]+)\.properties$/) || - filePath.match(/^([^\\]+)\\messages\\messages_([^.]+)\.properties$/); + const match = filePath.match(re); if (match === null) { return;