Skip to content

Commit 0c5c808

Browse files
committed
fix: enhance cross-platform compatibility in currentFileDir function
1 parent 3389a2a commit 0c5c808

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

adminforth/modules/utils.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,11 @@ export function guessLabelFromName(name) {
173173
export const currentFileDir = (metaUrl) => {
174174
const __filename = fileURLToPath(metaUrl);
175175
let __dirname = path.dirname(__filename);
176-
if (__dirname.endsWith('/dist/modules')) {
177-
// in prod build we are in dist also, so make another back jump to go true sorces
176+
177+
// Check for dist/modules in both Unix and Windows path formats
178+
const normalizedDir = __dirname.replace(/\\/g, '/');
179+
if (normalizedDir.endsWith('/dist/modules')) {
180+
// in prod build we are in dist also, so make another back jump to go to sources
178181
__dirname = path.join(__dirname, '..');
179182
}
180183
return __dirname;

0 commit comments

Comments
 (0)