cli/launcher: add file browser button for the theme option and fix parsing path containing spaces if only one theme is set

This commit is contained in:
bordun 2021-02-17 13:51:02 +01:00
parent 44b7729117
commit 2ccb55c08f
3 changed files with 19 additions and 8 deletions

View file

@ -25,15 +25,23 @@ class Theme {
if (!this.themes.length) return this
for (let theme of this.themes) {
if (this.themes.length > 1 && fs.existsSync(this.themes.join(' '))) {
if (theme.includes('.css') && fs.existsSync(theme)) {
this.files.push(theme)
} else if (!theme.includes('.css') && fs.existsSync(path.resolve(__dirname + '/../assets/themes/' + theme + '.css'))) {
this.files.push(path.resolve(__dirname + '/../assets/themes/' + theme + '.css'))
} else {
console.error('(ERROR) Theme not found: "' + theme)
this.files.push(this.themes.join(' '))
} else {
for (let theme of this.themes) {
if (theme.includes('.css') && fs.existsSync(theme)) {
this.files.push(theme)
} else if (!theme.includes('.css') && fs.existsSync(path.resolve(__dirname + '/../assets/themes/' + theme + '.css'))) {
this.files.push(path.resolve(__dirname + '/../assets/themes/' + theme + '.css'))
} else {
console.error('(ERROR) Theme not found: "' + theme)
}
}
}
if (this.files.length) {