修复Linux armv7l系统(如树莓派)下无法启动的问题
parent
1dce2c1f7a
commit
84e52f5525
|
@ -3,11 +3,16 @@ const fsPromises = require('fs').promises
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const { Arch } = require('electron-builder')
|
const { Arch } = require('electron-builder')
|
||||||
|
|
||||||
const replaceSqliteLib = async() => {
|
const fileNameMap = {
|
||||||
|
[Arch.arm64]: 'arm64',
|
||||||
|
[Arch.armv7l]: 'armv7l',
|
||||||
|
}
|
||||||
|
|
||||||
|
const replaceSqliteLib = async(arch) => {
|
||||||
// console.log(await fs.readdir(path.join(context.appOutDir, './resources/')))
|
// console.log(await fs.readdir(path.join(context.appOutDir, './resources/')))
|
||||||
// if (context.electronPlatformName != 'linux' || context.arch != Arch.arm64) return
|
// if (context.electronPlatformName != 'linux' || context.arch != Arch.arm64) return
|
||||||
console.log('replace sqlite lib...')
|
console.log('replace sqlite lib...')
|
||||||
const filePath = path.join(__dirname, './lib/better_sqlite3.linux.arm64.node')
|
const filePath = path.join(__dirname, `./lib/better_sqlite3.linux.${fileNameMap[arch]}.node`)
|
||||||
const targetPath = path.join(__dirname, '../node_modules/better-sqlite3/build/Release/better_sqlite3.node')
|
const targetPath = path.join(__dirname, '../node_modules/better-sqlite3/build/Release/better_sqlite3.node')
|
||||||
await fsPromises.unlink(targetPath).catch(_ => _)
|
await fsPromises.unlink(targetPath).catch(_ => _)
|
||||||
await fsPromises.copyFile(filePath, targetPath)
|
await fsPromises.copyFile(filePath, targetPath)
|
||||||
|
@ -19,13 +24,20 @@ module.exports = async(context) => {
|
||||||
if (electronPlatformName !== 'linux') return
|
if (electronPlatformName !== 'linux') return
|
||||||
const bindingFilePath = path.join(__dirname, '../node_modules/better-sqlite3/binding.gyp')
|
const bindingFilePath = path.join(__dirname, '../node_modules/better-sqlite3/binding.gyp')
|
||||||
const bindingBakFilePath = path.join(__dirname, '../node_modules/better-sqlite3/binding.gyp.bak')
|
const bindingBakFilePath = path.join(__dirname, '../node_modules/better-sqlite3/binding.gyp.bak')
|
||||||
if (arch == Arch.arm64) {
|
switch (arch) {
|
||||||
|
case Arch.arm64:
|
||||||
|
case Arch.armv7l:
|
||||||
|
if (fs.existsSync(bindingFilePath)) {
|
||||||
console.log('rename binding file...')
|
console.log('rename binding file...')
|
||||||
await fsPromises.rename(bindingFilePath, bindingBakFilePath)
|
await fsPromises.rename(bindingFilePath, bindingBakFilePath)
|
||||||
await replaceSqliteLib()
|
}
|
||||||
} else {
|
await replaceSqliteLib(arch)
|
||||||
|
break
|
||||||
|
|
||||||
|
default:
|
||||||
if (fs.existsSync(bindingFilePath)) return
|
if (fs.existsSync(bindingFilePath)) return
|
||||||
console.log('restore binding file...')
|
console.log('restore binding file...')
|
||||||
await fsPromises.rename(bindingBakFilePath, bindingFilePath)
|
await fsPromises.rename(bindingBakFilePath, bindingFilePath)
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
|
@ -5,3 +5,4 @@
|
||||||
- 修复从搜索界面进入歌单详情后,若启用强迫症设置的清空功能会导致意外清空搜索框、搜索列表的问题
|
- 修复从搜索界面进入歌单详情后,若启用强迫症设置的清空功能会导致意外清空搜索框、搜索列表的问题
|
||||||
- 就放桌面歌词在启用卡拉OK歌词后字体边缘可能被截断的问题
|
- 就放桌面歌词在启用卡拉OK歌词后字体边缘可能被截断的问题
|
||||||
- 修复桌面歌词启用歌词缩放后的阴影显示问题
|
- 修复桌面歌词启用歌词缩放后的阴影显示问题
|
||||||
|
- 修复Linux armv7l系统(如树莓派)下无法启动的问题(与修复Linux arm64的方法一样采用内置预编译模块的方式修复)
|
||||||
|
|
Loading…
Reference in New Issue