Skip to content

Commit 2903101

Browse files
committed
Fix packaged serialport loading for exp.7
1 parent 8e282ea commit 2903101

File tree

2 files changed

+4
-16
lines changed

2 files changed

+4
-16
lines changed

electron/osrSerial.ts

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
import { app } from 'electron'
21
import { execFile } from 'child_process'
32
import { SerialPortStream } from '@serialport/stream'
43
import type { AutoDetectTypes } from '@serialport/bindings-cpp'
54
import { createRequire } from 'module'
6-
import path from 'path'
75
import { promisify } from 'util'
86
import { OsrSerialPortInfo, OsrSerialState } from '../src/types'
97

@@ -229,19 +227,9 @@ function getSerialPortBinding(): SerialPortBinding {
229227
return cachedBinding
230228
}
231229

232-
const bindingsModule = app.isPackaged
233-
? runtimeRequire(
234-
path.join(
235-
process.resourcesPath,
236-
'app.asar.unpacked',
237-
'node_modules',
238-
'@serialport',
239-
'bindings-cpp',
240-
'dist',
241-
'index.js',
242-
),
243-
)
244-
: runtimeRequire('@serialport/bindings-cpp')
230+
// Keep JS dependency resolution inside app.asar. Electron still resolves the
231+
// unpacked native addon from the package when needed.
232+
const bindingsModule = runtimeRequire('@serialport/bindings-cpp')
245233

246234
cachedBinding = (bindingsModule as { autoDetect: () => SerialPortBinding }).autoDetect()
247235
return cachedBinding

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "scriptplayer-plus",
3-
"version": "0.1.5-exp.6",
3+
"version": "0.1.5-exp.7",
44
"description": "ScriptPlayer+ - Funscript video player with Handy and Intiface support",
55
"license": "PolyForm-Noncommercial-1.0.0",
66
"main": "dist-electron/main.js",

0 commit comments

Comments
 (0)