修复Linux arm64系统下无法启动的问题(#1102)

pull/1123/head
lyswhut 2023-01-05 18:47:27 +08:00
parent c8210e0516
commit 26e8e0a1b1
4 changed files with 34 additions and 4 deletions

View File

@ -0,0 +1,31 @@
const fs = require('fs')
const fsPromises = require('fs').promises
const path = require('path')
const { Arch } = require('electron-builder')
const replaceSqliteLib = async() => {
// console.log(await fs.readdir(path.join(context.appOutDir, './resources/')))
// if (context.electronPlatformName != 'linux' || context.arch != Arch.arm64) return
console.log('replace sqlite lib...')
const filePath = path.join(__dirname, './lib/better_sqlite3.linux.arm64.node')
const targetPath = path.join(__dirname, '../node_modules/better-sqlite3/build/Release/better_sqlite3.node')
await fsPromises.unlink(targetPath).catch(_ => _)
await fsPromises.copyFile(filePath, targetPath)
}
module.exports = async(context) => {
const { electronPlatformName, arch } = context
if (electronPlatformName !== 'linux') return
const bindingFilePath = path.join(__dirname, '../node_modules/better-sqlite3/binding.gyp')
const bindingBakFilePath = path.join(__dirname, '../node_modules/better-sqlite3/binding.gyp.bak')
if (arch == Arch.arm64) {
console.log('rename binding file...')
await fsPromises.rename(bindingFilePath, bindingBakFilePath)
await replaceSqliteLib()
} else {
if (fs.existsSync(bindingFilePath)) return
console.log('restore binding file...')
await fsPromises.rename(bindingBakFilePath, bindingFilePath)
}
}

Binary file not shown.

View File

@ -79,6 +79,7 @@
},
"build": {
"appId": "cn.toside.music.desktop",
"beforePack": "./build-config/build-before-pack.js",
"afterPack": "./build-config/build-after-pack.js",
"protocols": {
"name": "lx-music-protocol",
@ -193,10 +194,7 @@
"electron-app",
"vuejs3"
],
"author": {
"name": "lyswhut",
"email": "lyswhut@qq.com"
},
"author": "lyswhut <lyswhut@qq.com>",
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/lyswhut/lx-music-desktop/issues"

View File

@ -2,3 +2,4 @@
### 修复
- 修复初始设置的桌面歌词窗口没有完全居右下角的问题
- 修复Linux arm64系统下无法启动的问题#1102