@setoelkahfi / svara / commits / ea5410a

fix: fixed error in dragging/dropping files

Drag and drop should now work

mellbacon committed Jun 27, 2023 at 18:22 UTC ea5410a616eae00920075dae457d95497a6e9a8c
1 file changed +3 -3
src/lib/File.ts
+3 -3
@@ -79,13 +79,13 @@ function sortTree(tree: fs.FileEntry[]) {
79 }
80
81 export async function moveFile(source: string, dest: string, file: string, type: string) {
82 -
83 - if (!await dialog.confirm(`Are you sure you want to move "${file.split(path.sep).pop()}" from "./${source.split(path.sep).pop()}" into "./${dest.split(path.sep).pop()}?"`, {title: "Nucleus: Move File"})) {
82 + const filename = file.split(path.sep).pop();
83 + if (!await dialog.confirm(`Are you sure you want to move "${filename}" from "./${source.split(path.sep).pop()}" into "./${dest.split(path.sep).pop()}?"`, {title: "Nucleus: Move File"})) {
84 return;
85 }
86
87 try {
88 - await fs.renameFile(source, dest);
88 + await fs.renameFile(file, `${dest}${path.sep}${filename}`);
89 } catch (error) {
90 console.error(error);
91 }