fix foreign chars

This commit is contained in:
SpikeHD 2022-05-08 12:37:08 -07:00
parent c72e00f784
commit ed59684ac9

View File

@ -129,13 +129,13 @@ async function openGrasscutterFolder() {
// https://www.jimzhao.us/2015/09/javascript-detect-chinese-character.html // https://www.jimzhao.us/2015/09/javascript-detect-chinese-character.html
function hasForeignChars(str) { function hasForeignChars(str) {
let re1 = /^[A-Za-z\d,.?;:\\/'"!$%() ]*/g let re1 = /[^a-z0-9_.,-\\/: ]/g
str = str.replace(/\s/g, '') str = str.replace(/\s/g, '')
debug.log('Checking for foreign chars in path: ', str) debug.log('Checking for foreign chars in path: ', str)
debug.log('Path includes foreign chars? ', re1.test(str)) debug.log('Path includes foreign chars? ', re1.test(str))
return !re1.test(str) return re1.test(str)
} }
function openDialog(title, message, negBtn = false, affirmBtn = closeDialog) { function openDialog(title, message, negBtn = false, affirmBtn = closeDialog) {