Refactor Windows path handling for application data directories
All checks were successful
farmcontrol/farmcontrol-ui/pipeline/head This commit looks good
All checks were successful
farmcontrol/farmcontrol-ui/pipeline/head This commit looks good
- Updated multiple files to consistently use `os.homedir()` for constructing the local application data path, improving compatibility and clarity across the codebase. - This change enhances the reliability of directory retrieval for Windows environments.
This commit is contained in:
parent
1fdbb01ceb
commit
2335a64c03
@ -147,7 +147,9 @@ const isValidMsiPackage = async (filePath) => {
|
||||
const prepareInstallerPath = async (installerPath) => {
|
||||
const fileName = path.basename(installerPath)
|
||||
const updateDir = path.join(
|
||||
process.env.LOCALAPPDATA || path.join(os.homedir(), 'AppData', 'Local'),
|
||||
os.homedir(),
|
||||
'AppData',
|
||||
'Local',
|
||||
'FarmControl',
|
||||
'Updates'
|
||||
)
|
||||
|
||||
@ -19,9 +19,13 @@ const PIPE_RETRY_DELAY_MS = 100
|
||||
|
||||
export function getInstanceDir() {
|
||||
if (process.platform === 'win32') {
|
||||
const localAppData =
|
||||
process.env.LOCALAPPDATA || join(os.homedir(), 'AppData', 'Local')
|
||||
return join(localAppData, 'com.tombutcher.farmcontrol', 'instance')
|
||||
return join(
|
||||
os.homedir(),
|
||||
'AppData',
|
||||
'Local',
|
||||
'com.tombutcher.farmcontrol',
|
||||
'instance'
|
||||
)
|
||||
}
|
||||
|
||||
return join(process.env.TMPDIR || '/tmp', 'com.tombutcher.farmcontrol', 'instance')
|
||||
|
||||
@ -121,7 +121,9 @@ const spawnDetachedMacRestart = ({ appLaunchPath, parentPid }) => {
|
||||
|
||||
const spawnDetachedWindowsRestart = ({ appLaunchPath, parentPid }) => {
|
||||
const updateDir = path.join(
|
||||
process.env.LOCALAPPDATA || path.join(os.homedir(), 'AppData', 'Local'),
|
||||
os.homedir(),
|
||||
'AppData',
|
||||
'Local',
|
||||
'FarmControl',
|
||||
'Updates'
|
||||
)
|
||||
|
||||
@ -147,7 +147,9 @@ const isValidMsiPackage = async (filePath) => {
|
||||
export const prepareInstallerPath = async (installerPath) => {
|
||||
const fileName = path.basename(installerPath)
|
||||
const updateDir = path.join(
|
||||
process.env.LOCALAPPDATA || path.join(os.homedir(), 'AppData', 'Local'),
|
||||
os.homedir(),
|
||||
'AppData',
|
||||
'Local',
|
||||
'FarmControl',
|
||||
'Updates'
|
||||
)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user