mirror of
https://github.com/finos/SymphonyElectron.git
synced 2025-02-25 18:55:29 -06:00
SEARCH-444
- Created an api to clear the user index data folder
This commit is contained in:
@@ -119,32 +119,6 @@ class Crypto {
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Deleting the data index folder
|
||||
* when the app is closed
|
||||
*/
|
||||
deleteFolders() {
|
||||
Crypto.deleteFolderRecursive(this.dataFolder);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removing all the folders and files inside the data folder
|
||||
* @param location
|
||||
*/
|
||||
static deleteFolderRecursive(location) {
|
||||
if (fs.existsSync(location)) {
|
||||
fs.readdirSync(location).forEach((file) => {
|
||||
let curPath = location + "/" + file;
|
||||
if (fs.lstatSync(curPath).isDirectory()) {
|
||||
Crypto.deleteFolderRecursive(curPath);
|
||||
} else {
|
||||
fs.unlinkSync(curPath);
|
||||
}
|
||||
});
|
||||
fs.rmdirSync(location);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Crypto;
|
||||
Reference in New Issue
Block a user