修复 win7 无法启动的问题

This commit is contained in:
lyswhut
2026-09-14 20:05:55 +08:00
parent abcbf5fa00
commit 96fd33065a
6 changed files with 6 additions and 4 deletions

View File

@@ -133,6 +133,7 @@ jobs:
- name: Prepare win7 electron env
run: |
npm install electron@22
npm install better-sqlite3@12
pip.exe install setuptools
- name: Build Package win7 Setup x64

View File

@@ -113,6 +113,7 @@ jobs:
- name: Prepare win7 electron env
run: |
npm install electron@22
npm install better-sqlite3@12
pip.exe install setuptools
- name: Release win7 package

View File

@@ -33,8 +33,8 @@ const archMap = {
module.exports = async(context) => {
await beforePack()
const { arch } = context
const electronVersion = context.packager?.info?._framework?.version ?? require('../package.json').devDependencies.electron.replace(/^[^\d]*?(\d+)/, '$1')
await copyLib(archMap[arch], parseInt(electronVersion) == 22)
// const electronVersion = context.packager?.info?._framework?.version ?? require('../package.json').devDependencies.electron.replace(/^[^\d]*?(\d+)/, '$1')
await copyLib(archMap[arch])
// const electronNodeAbi = nodeAbi.getAbi(electronVersion, 'electron')
// if (electronPlatformName !== 'linux' || process.env.FORCE) return
// // const bindingFilePath = path.join(__dirname, '../node_modules/better-sqlite3/binding.gyp')

View File

@@ -40,8 +40,8 @@ const replaceSqliteLib = async(arch) => {
await fs.promises.unlink(targetPath).catch(_ => _)
await fs.promises.copyFile(filePath, targetPath)
}
exports.copyLib = async(arch = process.arch, replaceLocal = false) => {
if (process.platform === 'linux' || replaceLocal) {
exports.copyLib = async(arch = process.arch) => {
if (process.platform === 'linux') {
await replaceSqliteLib(arch)
return
}