Replicate previous behaviour

This commit is contained in:
Manav Rathi 2024-05-01 13:57:33 +05:30
parent f2a764aac2
commit 5ffc2f20fd
No known key found for this signature in database

View file

@ -547,6 +547,9 @@ class ExportService {
isCanceled: CancellationStatus,
) {
const fs = ensureElectron().fs;
const rmdirIfExists = async (dirPath: string) => {
if (await fs.exists(dirPath)) await fs.rmdir(dirPath);
};
try {
const exportRecord = await this.getExportRecord(exportFolder);
const collectionIDPathMap =
@ -581,11 +584,11 @@ class ExportService {
);
try {
// delete the collection metadata folder
await fs.rmdir(
await rmdirIfExists(
getMetadataFolderExportPath(collectionExportPath),
);
// delete the collection folder
await fs.rmdir(collectionExportPath);
await rmdirIfExists(collectionExportPath);
} catch (e) {
await this.addCollectionExportedRecord(
exportFolder,