From 554c2a3efaa75ab059d3aac0f18e8df45d644851 Mon Sep 17 00:00:00 2001 From: RocketRobz Date: Sun, 21 Oct 2018 21:26:06 -0600 Subject: [PATCH] Do not copy and paste file in same location as copied file --- arm9/source/file_browse.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/arm9/source/file_browse.cpp b/arm9/source/file_browse.cpp index 7ca2aed..afc3f8c 100644 --- a/arm9/source/file_browse.cpp +++ b/arm9/source/file_browse.cpp @@ -302,7 +302,7 @@ int fileBrowse_A(DirEntry* entry, char path[PATH_MAX]) { } } -bool fileBrowse_paste(char path[PATH_MAX]) { +bool fileBrowse_paste(char destPath[256]) { int pressed = 0; int optionOffset = 0; int maxCursors = -1; @@ -346,8 +346,6 @@ bool fileBrowse_paste(char path[PATH_MAX]) { if (optionOffset > maxCursors) optionOffset = 0; // Wrap around to top of list if (pressed & KEY_A) { - char destPath[256]; - snprintf(destPath, sizeof(destPath), "%s%s", path, clipboardFilename); iprintf ("\x1b[%d;3H", optionOffset + OPTIONS_ENTRIES_START_ROW); if (optionOffset == 0) { printf("Copying..."); @@ -591,8 +589,10 @@ string browseForFile (void) { if (pressed & KEY_Y) { if (clipboardOn) { - if (strncmp (path, "nitro:/", 7) != 0) { - if (fileBrowse_paste(path)) { + char destPath[256]; + snprintf(destPath, sizeof(destPath), "%s%s", path, clipboardFilename); + if (strncmp (path, "nitro:/", 7) != 0 && string(clipboard) != string(destPath)) { + if (fileBrowse_paste(destPath)) { getDirectoryContents (dirContents); } }