update script to compat windows

This commit is contained in:
王劲鹏 2021-01-20 17:22:26 +08:00 committed by osborn
parent 7570278352
commit 0be7a9679a

View File

@ -15,7 +15,7 @@ function searchImages(dir, images) {
if (stat.isDirectory()) {
searchImages(path.join(dir, item), images)
} else {
if(fullPath.endsWith('.png')) {
if (fullPath.endsWith('.png')) {
images.push(fullPath)
}
}
@ -39,11 +39,13 @@ function mkdirsSync(dirname) {
allImages.forEach((value) => {
let path = __dirname + '/build/' + value
path = path.split("\\").join("/")
let index = path.lastIndexOf('/')
mkdirsSync(path.substring(0, index))
fs.copyFile(__dirname + '/' + value, __dirname + '/build/' + value, error => {
console.log(error)
if (error)
console.log(error)
})
})
@ -55,7 +57,7 @@ function readDirs(dirPath, files) {
})
} else {
for (let bundle of bundles) {
if (dirPath.match(new RegExp(`^${bundle}`))) {
if (dirPath.replace("\\", "/").match(new RegExp(`^${bundle}`))) {
files.push(dirPath)
}
}