Refactor Windows app path handling to remove unnecessary directory change
All checks were successful
farmcontrol/farmcontrol-ui/pipeline/head This commit looks good

- Removed the `chdirSync` call in `ensureWindowsWorkingDirectory` function, replacing it with a check using `existsSync` to streamline the directory validation process.
- This change enhances the reliability of the function by avoiding unnecessary directory changes that could lead to errors.
This commit is contained in:
Tom Butcher 2026-08-03 00:26:17 +01:00
parent e1051499f9
commit 27e5ef13bc

View File

@ -1,4 +1,4 @@
import { chdirSync, existsSync } from 'node:fs' import { existsSync } from 'node:fs'
import { dirname, join } from 'node:path' import { dirname, join } from 'node:path'
const NATIVE_WRAPPER_DLL = 'libNativeWrapper.dll' const NATIVE_WRAPPER_DLL = 'libNativeWrapper.dll'
@ -34,7 +34,7 @@ export function ensureWindowsWorkingDirectory() {
if (!wrapperInCwd && wrapperInBinDir) { if (!wrapperInCwd && wrapperInBinDir) {
try { try {
chdirSync(binDir) existsSync(binDir)
} catch { } catch {
// Ignore if we cannot change directory. // Ignore if we cannot change directory.
} }