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 prepareInstallerPath = async (installerPath) => {
|
||||||
const fileName = path.basename(installerPath)
|
const fileName = path.basename(installerPath)
|
||||||
const updateDir = path.join(
|
const updateDir = path.join(
|
||||||
process.env.LOCALAPPDATA || path.join(os.homedir(), 'AppData', 'Local'),
|
os.homedir(),
|
||||||
|
'AppData',
|
||||||
|
'Local',
|
||||||
'FarmControl',
|
'FarmControl',
|
||||||
'Updates'
|
'Updates'
|
||||||
)
|
)
|
||||||
|
|||||||
@ -19,9 +19,13 @@ const PIPE_RETRY_DELAY_MS = 100
|
|||||||
|
|
||||||
export function getInstanceDir() {
|
export function getInstanceDir() {
|
||||||
if (process.platform === 'win32') {
|
if (process.platform === 'win32') {
|
||||||
const localAppData =
|
return join(
|
||||||
process.env.LOCALAPPDATA || join(os.homedir(), 'AppData', 'Local')
|
os.homedir(),
|
||||||
return join(localAppData, 'com.tombutcher.farmcontrol', 'instance')
|
'AppData',
|
||||||
|
'Local',
|
||||||
|
'com.tombutcher.farmcontrol',
|
||||||
|
'instance'
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
return join(process.env.TMPDIR || '/tmp', '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 spawnDetachedWindowsRestart = ({ appLaunchPath, parentPid }) => {
|
||||||
const updateDir = path.join(
|
const updateDir = path.join(
|
||||||
process.env.LOCALAPPDATA || path.join(os.homedir(), 'AppData', 'Local'),
|
os.homedir(),
|
||||||
|
'AppData',
|
||||||
|
'Local',
|
||||||
'FarmControl',
|
'FarmControl',
|
||||||
'Updates'
|
'Updates'
|
||||||
)
|
)
|
||||||
|
|||||||
@ -147,7 +147,9 @@ const isValidMsiPackage = async (filePath) => {
|
|||||||
export const prepareInstallerPath = async (installerPath) => {
|
export const prepareInstallerPath = async (installerPath) => {
|
||||||
const fileName = path.basename(installerPath)
|
const fileName = path.basename(installerPath)
|
||||||
const updateDir = path.join(
|
const updateDir = path.join(
|
||||||
process.env.LOCALAPPDATA || path.join(os.homedir(), 'AppData', 'Local'),
|
os.homedir(),
|
||||||
|
'AppData',
|
||||||
|
'Local',
|
||||||
'FarmControl',
|
'FarmControl',
|
||||||
'Updates'
|
'Updates'
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user