From 58dcdb8bdc9d6a23727491bd8266ad59c334b0f3 Mon Sep 17 00:00:00 2001 From: Xterionix <72647213+Xterionix@users.noreply.github.com> Date: Tue, 19 Sep 2023 03:23:05 +0500 Subject: [PATCH] - Bandaid fix for duplicating file issue #341 --- app/renderer/src/UI/Sidebar/FileExplorer.ts | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/app/renderer/src/UI/Sidebar/FileExplorer.ts b/app/renderer/src/UI/Sidebar/FileExplorer.ts index d289d4924..626026f16 100644 --- a/app/renderer/src/UI/Sidebar/FileExplorer.ts +++ b/app/renderer/src/UI/Sidebar/FileExplorer.ts @@ -90,7 +90,7 @@ export class FileExplorer { if (this.parent) this.parent.sort() requestIdleCallback(() => this.load()) //Load more files and folders during CPU idle time - } catch (e) {} + } catch (e) { } } async load() { this.children = await Promise.all( @@ -184,9 +184,9 @@ export class FileExplorer { if (this.name === 'cache') return [] return this.is_folder ? this.children - .map(c => c.getAllFiles()) - .flat() - .filter(c => c !== undefined) + .map(c => c.getAllFiles()) + .flat() + .filter(c => c !== undefined) : [this.absolute_path] } @@ -222,15 +222,17 @@ export class FileExplorer { ) await Promise.all([ - OmegaCache.duplicate( - this.absolute_path, - newAbsolutePath - ).catch(() => {}), - LightningCache.duplicate(this.absolute_path, newAbsolutePath), + // OmegaCache.duplicate( + // this.absolute_path, + // newAbsolutePath + // ).catch(() => { }), + // LightningCache.duplicate(this.absolute_path, newAbsolutePath), JSONFileMasks.duplicate(this.absolute_path, newAbsolutePath), fs.copyFile(this.absolute_path, newAbsolutePath), ]) + console.log(this.absolute_path, newAbsolutePath) + this.parent.children.push( new FileExplorer( this.parent,