Skip to content

Commit

Permalink
fix: move jan data folder - error handling - no write permission gran…
Browse files Browse the repository at this point in the history
…ted (janhq#2077)
  • Loading branch information
louis-jan authored Feb 18, 2024
1 parent 3ea8c60 commit 96df4ad
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions web/screens/Settings/Advanced/DataFolder/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,11 @@ const DataFolder = () => {
await window.core?.api?.getAppConfigurations()
const currentJanDataFolder = appConfiguration.data_folder
appConfiguration.data_folder = destinationPath
await fs.syncFile(currentJanDataFolder, destinationPath)
const { _, err } = await fs.syncFile(
currentJanDataFolder,
destinationPath
)
if (err) throw err
await window.core?.api?.updateAppConfiguration(appConfiguration)
console.debug(
`File sync finished from ${currentJanDataFolder} to ${destinationPath}`
Expand All @@ -94,7 +98,7 @@ const DataFolder = () => {
}, 1200)
await window.core?.api?.relaunch()
} catch (e) {
console.error(`Error: ${e}`)
console.error(e)
setShowLoader(false)
setShowChangeFolderError(true)
}
Expand Down

0 comments on commit 96df4ad

Please sign in to comment.