Skip to content

Commit

Permalink
fix: wrong path when as space #26
Browse files Browse the repository at this point in the history
  • Loading branch information
hrenaud committed Aug 1, 2024
1 parent 24ab185 commit 96e7856
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions electron-app/ecoindex-app/src/main/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import {
Menu,
Notification,
app,
autoUpdater,
dialog,
ipcMain,
shell,
shell
} from 'electron'
import { ChildProcess, spawn } from 'child_process'
import {
Expand Down Expand Up @@ -53,11 +54,21 @@ if (require('electron-squirrel-startup')) {
log.initialize()
const mainLog = log.scope('main')

try {
const server = 'https://update.electronjs.org'
const feed:any = `${server}/cnumr/lighthouse-plugin-ecoindex/${process.platform}-${process.arch}/electron-${app.getVersion()}`

autoUpdater.setFeedURL(feed)

updateElectronApp({
updateInterval: '10 minutes',
logger: require('electron-log'),
notifyUser: true,
}) // additional configuration options available
} catch (error) {
mainLog.error(`Error on process AutoUpdater`, error)
}


// const execFile = util.promisify(_execFile);

Expand Down Expand Up @@ -679,14 +690,14 @@ const handleWorkDir = async (event: IpcMainEvent, newDir: string) => {
mainLog.error('Home dir not found in userInfo()')
throw new Error('Home dir not found in userInfo()')
}
setHomeDir(homedir)
setHomeDir(`${homedir}`)
if (newDir) {
// log replaced by electron-log
// setLogStream(getLogFilePathFromDir(newDir))

setWorkDir(newDir)
setWorkDir(`${newDir}`)
} else {
setWorkDir(getHomeDir())
setWorkDir(`${getHomeDir()}`)
}
return await getWorkDir()
}
Expand Down Expand Up @@ -1120,8 +1131,8 @@ const handleSelectFolder = async () => {
}
const { canceled, filePaths } = await dialog.showOpenDialog(options)
if (!canceled) {
setWorkDir(filePaths[0])
return filePaths[0]
setWorkDir(`"${filePaths[0]}"`)
return `"${filePaths[0]}"`
}
} catch (error) {
mainLog.error(`Error in handleSelectFolder`)
Expand Down

0 comments on commit 96e7856

Please sign in to comment.