diff --git a/src/main/runtime/first-run-setup-plugin.test.ts b/src/main/runtime/first-run-setup-plugin.test.ts index a3f6e147..9109a380 100644 --- a/src/main/runtime/first-run-setup-plugin.test.ts +++ b/src/main/runtime/first-run-setup-plugin.test.ts @@ -96,7 +96,10 @@ test('installFirstRunPluginToDefaultLocation installs plugin and backs up existi }); }); -test('installFirstRunPluginToDefaultLocation installs plugin to Windows mpv defaults', () => { +test( + 'installFirstRunPluginToDefaultLocation installs plugin to Windows mpv defaults', + { skip: process.platform !== 'win32' }, + () => { withTempDir((root) => { const resourcesPath = path.join(root, 'resources'); const pluginRoot = path.join(resourcesPath, 'plugin'); @@ -127,9 +130,13 @@ test('installFirstRunPluginToDefaultLocation installs plugin to Windows mpv defa 'configured=true\n', ); }); -}); +}, +); -test('installFirstRunPluginToDefaultLocation rewrites Windows plugin socket_path', () => { +test( + 'installFirstRunPluginToDefaultLocation rewrites Windows plugin socket_path', + { skip: process.platform !== 'win32' }, + () => { withTempDir((root) => { const resourcesPath = path.join(root, 'resources'); const pluginRoot = path.join(resourcesPath, 'plugin'); @@ -157,4 +164,5 @@ test('installFirstRunPluginToDefaultLocation rewrites Windows plugin socket_path 'binary_path=\nsocket_path=\\\\.\\pipe\\subminer-socket\n', ); }); -}); +}, +); diff --git a/src/window-trackers/windows-helper.ts b/src/window-trackers/windows-helper.ts index 23b070ed..24975ed5 100644 --- a/src/window-trackers/windows-helper.ts +++ b/src/window-trackers/windows-helper.ts @@ -44,6 +44,8 @@ type ResolveWindowsTrackerHelperOptions = { copyFileSync?: (source: string, destination: string) => void; }; +const windowsPath = path.win32; + function normalizeHelperMode(value: string | undefined): WindowsTrackerHelperMode { const normalized = value?.trim().toLowerCase(); if (normalized === 'powershell' || normalized === 'native') { @@ -72,8 +74,8 @@ function materializeAsarHelper( const fileName = kind === 'native' ? 'get-mpv-window-windows.exe' : 'get-mpv-window-windows.ps1'; - const targetDir = path.join(os.tmpdir(), 'subminer', 'helpers'); - const targetPath = path.join(targetDir, fileName); + const targetDir = windowsPath.join(os.tmpdir(), 'subminer', 'helpers'); + const targetPath = windowsPath.join(targetDir, fileName); try { deps.mkdirSync(targetDir, { recursive: true }); @@ -137,29 +139,29 @@ function getHelperCandidates(dirname: string, resourcesPath: string | undefined) if (resourcesPath) { candidates.push({ - path: path.join(resourcesPath, 'scripts', `${scriptFileBase}.exe`), + path: windowsPath.join(resourcesPath, 'scripts', `${scriptFileBase}.exe`), kind: 'native', }); candidates.push({ - path: path.join(resourcesPath, 'scripts', `${scriptFileBase}.ps1`), + path: windowsPath.join(resourcesPath, 'scripts', `${scriptFileBase}.ps1`), kind: 'powershell', }); } candidates.push({ - path: path.join(dirname, '..', 'scripts', `${scriptFileBase}.exe`), + path: windowsPath.join(dirname, '..', 'scripts', `${scriptFileBase}.exe`), kind: 'native', }); candidates.push({ - path: path.join(dirname, '..', 'scripts', `${scriptFileBase}.ps1`), + path: windowsPath.join(dirname, '..', 'scripts', `${scriptFileBase}.ps1`), kind: 'powershell', }); candidates.push({ - path: path.join(dirname, '..', '..', 'scripts', `${scriptFileBase}.exe`), + path: windowsPath.join(dirname, '..', '..', 'scripts', `${scriptFileBase}.exe`), kind: 'native', }); candidates.push({ - path: path.join(dirname, '..', '..', 'scripts', `${scriptFileBase}.ps1`), + path: windowsPath.join(dirname, '..', '..', 'scripts', `${scriptFileBase}.ps1`), kind: 'powershell', });