mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 00:12:56 +02:00
MDL-66307 js: fix path handling on Windows
This commit is contained in:
parent
2c28ba8888
commit
ac1a91bf47
@ -36,6 +36,7 @@
|
||||
|
||||
module.exports = ({ template, types }) => {
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const glob = require('glob');
|
||||
const cwd = process.cwd();
|
||||
|
||||
@ -92,7 +93,7 @@ module.exports = ({ template, types }) => {
|
||||
*/
|
||||
function getModuleNameFromFileName(searchFileName) {
|
||||
searchFileName = fs.realpathSync(searchFileName);
|
||||
const relativeFileName = searchFileName.replace(`${cwd}/`, '');
|
||||
const relativeFileName = searchFileName.replace(`${cwd}${path.sep}`, '').replace(/\\/g, '/');
|
||||
const [componentPath, file] = relativeFileName.split('/amd/src/');
|
||||
const fileName = file.replace('.js', '');
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user