From e672460d0115f654e116705c8b42bbc5b256372c Mon Sep 17 00:00:00 2001 From: Tom Gobich Date: Thu, 7 Nov 2024 19:15:51 -0500 Subject: [PATCH] fixed(windows): issue where slashes weren't normalized when determining model's name --- services/model_service.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/services/model_service.ts b/services/model_service.ts index a7f1192..3805904 100644 --- a/services/model_service.ts +++ b/services/model_service.ts @@ -1,6 +1,7 @@ import FileService from './file_service.js' import { generators } from '@adonisjs/core/app' import string from '@adonisjs/core/helpers/string' +import { slash } from '@adonisjs/core/helpers' import { ApplicationService } from '@adonisjs/core/types' import { fsReadAll } from '@adonisjs/core/helpers' import UtilService from './util_service.js' @@ -46,7 +47,7 @@ export default class ModelService { const modelsPath = this.app.modelsPath() const modelFilePaths = await fsReadAll(modelsPath, { pathType: 'absolute' }) const promises = modelFilePaths.map(async (filePath) => { - const name = generators.modelName(filePath.split('/').pop()!) + const name = generators.modelName(slash(filePath).split('/').pop()!) return this.getModelInfo({ name, filePath }, name) })