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:
Daniel Scalzi 2021-06-23 20:27:04 -04:00
parent 61dbabdba3
commit 2c487f71ad
No known key found for this signature in database
GPG Key ID: D18EA3FB4B142A57
5 changed files with 323 additions and 450 deletions

View File

@ -92,14 +92,17 @@ exports.addDropinMods = function(files, modsdir) {
* @param {string} modsDir The path to the mods directory.
* @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){
const res = shell.moveItemToTrash(path.join(modsDir, fullName))
if(!res){
exports.deleteDropinMod = async function(modsDir, fullName){
try {
await shell.trashItem(path.join(modsDir, fullName))
return true
} catch(error) {
shell.beep()
console.error('Error deleting drop-in mod.', error)
return false
}
return res
}
/**

View File

@ -687,9 +687,9 @@ function resolveDropinModsForUI(){
function bindDropinModsRemoveButton(){
const sEls = settingsModsContainer.querySelectorAll('[remmod]')
Array.from(sEls).map((v, index, arr) => {
v.onclick = () => {
v.onclick = async () => {
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){
document.getElementById(fullName).remove()
} else {

View File

@ -8,7 +8,7 @@ const fs = require('fs')
const isDev = require('./app/assets/js/isdev')
const path = require('path')
const semver = require('semver')
const url = require('url')
const { pathToFileURL } = require('url')
// Setup auto updater.
function initAutoUpdater(event, data) {
@ -105,19 +105,14 @@ function createWindow() {
preload: path.join(__dirname, 'app', 'assets', 'js', 'preloader.js'),
nodeIntegration: true,
contextIsolation: false,
enableRemoteModule: true,
worldSafeExecuteJavaScript: true
enableRemoteModule: true
},
backgroundColor: '#171614'
})
ejse.data('bkid', Math.floor((Math.random() * fs.readdirSync(path.join(__dirname, 'app', 'assets', 'images', 'backgrounds')).length)))
win.loadURL(url.format({
pathname: path.join(__dirname, 'app', 'app.ejs'),
protocol: 'file:',
slashes: true
}))
win.loadURL(pathToFileURL(path.join(__dirname, 'app', 'app.ejs')).toString())
/*win.once('ready-to-show', () => {
win.show()

735
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -23,10 +23,10 @@
"node": "14.x.x"
},
"dependencies": {
"@electron/remote": "^1.1.0",
"@electron/remote": "^1.2.0",
"adm-zip": "^0.5.5",
"async": "^3.2.0",
"discord-rpc": "^3.2.0",
"discord-rpc": "^4.0.1",
"ejs": "^3.1.6",
"ejs-electron": "^2.1.1",
"electron-updater": "^4.3.9",
@ -39,9 +39,9 @@
"winreg": "^1.2.4"
},
"devDependencies": {
"electron": "^12.0.7",
"electron-builder": "^22.10.5",
"eslint": "^7.26.0"
"electron": "^13.1.4",
"electron-builder": "^22.11.7",
"eslint": "^7.29.0"
},
"repository": {
"type": "git",