fix: 修复linux中so库加载的问题

This commit is contained in:
H3CoF6
2026-03-18 03:54:38 +08:00
parent be7d173746
commit f4ad6bf263
2 changed files with 5 additions and 1 deletions

View File

@@ -17,6 +17,7 @@ import { annualReportService } from './services/annualReportService'
import { exportService, ExportOptions, ExportProgress } from './services/exportService' import { exportService, ExportOptions, ExportProgress } from './services/exportService'
import { KeyService } from './services/keyService' import { KeyService } from './services/keyService'
import { KeyServiceMac } from './services/keyServiceMac' import { KeyServiceMac } from './services/keyServiceMac'
import { KeyServiceLinux} from "./services/keyServiceLinux"
import { voiceTranscribeService } from './services/voiceTranscribeService' import { voiceTranscribeService } from './services/voiceTranscribeService'
import { videoService } from './services/videoService' import { videoService } from './services/videoService'
import { snsService, isVideoUrl } from './services/snsService' import { snsService, isVideoUrl } from './services/snsService'
@@ -95,7 +96,7 @@ let keyService: any
if (process.platform === 'darwin') { if (process.platform === 'darwin') {
keyService = new KeyServiceMac() keyService = new KeyServiceMac()
} else if (process.platform === 'linux') { } else if (process.platform === 'linux') {
const { KeyServiceLinux } = require('./services/keyServiceLinux') // const { KeyServiceLinux } = require('./services/keyServiceLinux')
keyService = new KeyServiceLinux() keyService = new KeyServiceLinux()
} else { } else {
keyService = new KeyService() keyService = new KeyService()

View File

@@ -551,6 +551,7 @@ export class WcdbCore {
const dllDir = dirname(dllPath) const dllDir = dirname(dllPath)
const isMac = process.platform === 'darwin' const isMac = process.platform === 'darwin'
const isLinux = process.platform === 'linux'
// 预加载依赖库 // 预加载依赖库
if (isMac) { if (isMac) {
@@ -564,6 +565,8 @@ export class WcdbCore {
this.writeLog(`预加载 libWCDB.dylib 失败: ${String(e)}`) this.writeLog(`预加载 libWCDB.dylib 失败: ${String(e)}`)
} }
} }
} else if (isLinux) {
// 如果有libWCDB.so的话 没有就算了
} else { } else {
const wcdbCorePath = join(dllDir, 'WCDB.dll') const wcdbCorePath = join(dllDir, 'WCDB.dll')
if (existsSync(wcdbCorePath)) { if (existsSync(wcdbCorePath)) {