mirror of
https://github.com/finos/SymphonyElectron.git
synced 2025-02-25 18:55:29 -06:00
electron-205: added logic to handle directory creation failure
This commit is contained in:
@@ -244,9 +244,13 @@ function doCreateMainWindow(initialUrl, initialBounds) {
|
|||||||
getConfigField('downloadsDirectory')
|
getConfigField('downloadsDirectory')
|
||||||
.then((value) => {
|
.then((value) => {
|
||||||
downloadsDirectory = value;
|
downloadsDirectory = value;
|
||||||
// if the directory has been deleted, create it.
|
// if the directory has been deleted, try creating it.
|
||||||
if (!fs.existsSync(downloadsDirectory)) {
|
if (!fs.existsSync(downloadsDirectory)) {
|
||||||
fs.mkdirSync(downloadsDirectory);
|
const directoryCreated = fs.mkdirSync(downloadsDirectory);
|
||||||
|
// If the directory creation failed, we use the default downloads directory
|
||||||
|
if (!directoryCreated) {
|
||||||
|
downloadsDirectory = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user