Electron 13.
Deleting drop-in mods seems to be broken. If you're having this issue, please comment on this issue so electron fixes it.. https://github.com/electron/electron/issues/29598
This commit is contained in:
parent
61dbabdba3
commit
2c487f71ad
@ -92,14 +92,17 @@ exports.addDropinMods = function(files, modsdir) {
|
|||||||
* @param {string} modsDir The path to the mods directory.
|
* @param {string} modsDir The path to the mods directory.
|
||||||
* @param {string} fullName The fullName of the discovered mod to delete.
|
* @param {string} fullName The fullName of the discovered mod to delete.
|
||||||
*
|
*
|
||||||
* @returns {boolean} True if the mod was deleted, otherwise false.
|
* @returns {Promise.<boolean>} True if the mod was deleted, otherwise false.
|
||||||
*/
|
*/
|
||||||
exports.deleteDropinMod = function(modsDir, fullName){
|
exports.deleteDropinMod = async function(modsDir, fullName){
|
||||||
const res = shell.moveItemToTrash(path.join(modsDir, fullName))
|
try {
|
||||||
if(!res){
|
await shell.trashItem(path.join(modsDir, fullName))
|
||||||
|
return true
|
||||||
|
} catch(error) {
|
||||||
shell.beep()
|
shell.beep()
|
||||||
|
console.error('Error deleting drop-in mod.', error)
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
return res
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -687,9 +687,9 @@ function resolveDropinModsForUI(){
|
|||||||
function bindDropinModsRemoveButton(){
|
function bindDropinModsRemoveButton(){
|
||||||
const sEls = settingsModsContainer.querySelectorAll('[remmod]')
|
const sEls = settingsModsContainer.querySelectorAll('[remmod]')
|
||||||
Array.from(sEls).map((v, index, arr) => {
|
Array.from(sEls).map((v, index, arr) => {
|
||||||
v.onclick = () => {
|
v.onclick = async () => {
|
||||||
const fullName = v.getAttribute('remmod')
|
const fullName = v.getAttribute('remmod')
|
||||||
const res = DropinModUtil.deleteDropinMod(CACHE_SETTINGS_MODS_DIR, fullName)
|
const res = await DropinModUtil.deleteDropinMod(CACHE_SETTINGS_MODS_DIR, fullName)
|
||||||
if(res){
|
if(res){
|
||||||
document.getElementById(fullName).remove()
|
document.getElementById(fullName).remove()
|
||||||
} else {
|
} else {
|
||||||
|
11
index.js
11
index.js
@ -8,7 +8,7 @@ const fs = require('fs')
|
|||||||
const isDev = require('./app/assets/js/isdev')
|
const isDev = require('./app/assets/js/isdev')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const semver = require('semver')
|
const semver = require('semver')
|
||||||
const url = require('url')
|
const { pathToFileURL } = require('url')
|
||||||
|
|
||||||
// Setup auto updater.
|
// Setup auto updater.
|
||||||
function initAutoUpdater(event, data) {
|
function initAutoUpdater(event, data) {
|
||||||
@ -105,19 +105,14 @@ function createWindow() {
|
|||||||
preload: path.join(__dirname, 'app', 'assets', 'js', 'preloader.js'),
|
preload: path.join(__dirname, 'app', 'assets', 'js', 'preloader.js'),
|
||||||
nodeIntegration: true,
|
nodeIntegration: true,
|
||||||
contextIsolation: false,
|
contextIsolation: false,
|
||||||
enableRemoteModule: true,
|
enableRemoteModule: true
|
||||||
worldSafeExecuteJavaScript: true
|
|
||||||
},
|
},
|
||||||
backgroundColor: '#171614'
|
backgroundColor: '#171614'
|
||||||
})
|
})
|
||||||
|
|
||||||
ejse.data('bkid', Math.floor((Math.random() * fs.readdirSync(path.join(__dirname, 'app', 'assets', 'images', 'backgrounds')).length)))
|
ejse.data('bkid', Math.floor((Math.random() * fs.readdirSync(path.join(__dirname, 'app', 'assets', 'images', 'backgrounds')).length)))
|
||||||
|
|
||||||
win.loadURL(url.format({
|
win.loadURL(pathToFileURL(path.join(__dirname, 'app', 'app.ejs')).toString())
|
||||||
pathname: path.join(__dirname, 'app', 'app.ejs'),
|
|
||||||
protocol: 'file:',
|
|
||||||
slashes: true
|
|
||||||
}))
|
|
||||||
|
|
||||||
/*win.once('ready-to-show', () => {
|
/*win.once('ready-to-show', () => {
|
||||||
win.show()
|
win.show()
|
||||||
|
735
package-lock.json
generated
735
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
10
package.json
10
package.json
@ -23,10 +23,10 @@
|
|||||||
"node": "14.x.x"
|
"node": "14.x.x"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@electron/remote": "^1.1.0",
|
"@electron/remote": "^1.2.0",
|
||||||
"adm-zip": "^0.5.5",
|
"adm-zip": "^0.5.5",
|
||||||
"async": "^3.2.0",
|
"async": "^3.2.0",
|
||||||
"discord-rpc": "^3.2.0",
|
"discord-rpc": "^4.0.1",
|
||||||
"ejs": "^3.1.6",
|
"ejs": "^3.1.6",
|
||||||
"ejs-electron": "^2.1.1",
|
"ejs-electron": "^2.1.1",
|
||||||
"electron-updater": "^4.3.9",
|
"electron-updater": "^4.3.9",
|
||||||
@ -39,9 +39,9 @@
|
|||||||
"winreg": "^1.2.4"
|
"winreg": "^1.2.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"electron": "^12.0.7",
|
"electron": "^13.1.4",
|
||||||
"electron-builder": "^22.10.5",
|
"electron-builder": "^22.11.7",
|
||||||
"eslint": "^7.26.0"
|
"eslint": "^7.29.0"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
Loading…
Reference in New Issue
Block a user