mirror of
https://github.com/d0k3/GodMode9.git
synced 2025-06-26 21:52:48 +00:00
Fix move - exist - skip handling
This commit is contained in:
parent
03e11e7064
commit
25e007765c
16
source/fs.c
16
source/fs.c
@ -622,7 +622,10 @@ bool PathCopyVirtual(const char* destdir, const char* orig, u32* flags) {
|
|||||||
|
|
||||||
// check if destination exists
|
// check if destination exists
|
||||||
if (flags && !(*flags & OVERWRITE_ALL) && f_stat(dest, NULL) == FR_OK) {
|
if (flags && !(*flags & OVERWRITE_ALL) && f_stat(dest, NULL) == FR_OK) {
|
||||||
if (*flags & SKIP_ALL) return true;
|
if (*flags & SKIP_ALL) {
|
||||||
|
*flags |= SKIP_CUR;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
const char* optionstr[5] =
|
const char* optionstr[5] =
|
||||||
{"Choose new name", "Overwrite file", "Skip file", "Overwrite all", "Skip all"};
|
{"Choose new name", "Overwrite file", "Skip file", "Overwrite all", "Skip all"};
|
||||||
u32 user_select = ShowSelectPrompt((*flags & ASK_ALL) ? 5 : 3, optionstr,
|
u32 user_select = ShowSelectPrompt((*flags & ASK_ALL) ? 5 : 3, optionstr,
|
||||||
@ -641,7 +644,7 @@ bool PathCopyVirtual(const char* destdir, const char* orig, u32* flags) {
|
|||||||
} else if (user_select == 4) {
|
} else if (user_select == 4) {
|
||||||
*flags |= OVERWRITE_ALL;
|
*flags |= OVERWRITE_ALL;
|
||||||
} else if (user_select == 5) {
|
} else if (user_select == 5) {
|
||||||
*flags |= SKIP_ALL;
|
*flags |= (SKIP_CUR|SKIP_ALL);
|
||||||
return true;
|
return true;
|
||||||
} else if (user_select != 2) {
|
} else if (user_select != 2) {
|
||||||
return false;
|
return false;
|
||||||
@ -715,7 +718,10 @@ bool PathCopyWorker(char* dest, char* orig, u32* flags, bool move) {
|
|||||||
|
|
||||||
// check if destination exists
|
// check if destination exists
|
||||||
if (flags && !(*flags & (OVERWRITE_CUR|OVERWRITE_ALL)) && (f_stat(dest, NULL) == FR_OK)) {
|
if (flags && !(*flags & (OVERWRITE_CUR|OVERWRITE_ALL)) && (f_stat(dest, NULL) == FR_OK)) {
|
||||||
if (*flags & SKIP_ALL) return true;
|
if (*flags & SKIP_ALL) {
|
||||||
|
*flags |= SKIP_CUR;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
const char* optionstr[5] =
|
const char* optionstr[5] =
|
||||||
{"Choose new name", "Overwrite file(s)", "Skip file(s)", "Overwrite all", "Skip all"};
|
{"Choose new name", "Overwrite file(s)", "Skip file(s)", "Overwrite all", "Skip all"};
|
||||||
char namestr[36 + 1];
|
char namestr[36 + 1];
|
||||||
@ -735,7 +741,7 @@ bool PathCopyWorker(char* dest, char* orig, u32* flags, bool move) {
|
|||||||
} else if (user_select == 4) {
|
} else if (user_select == 4) {
|
||||||
*flags |= OVERWRITE_ALL;
|
*flags |= OVERWRITE_ALL;
|
||||||
} else if (user_select == 5) {
|
} else if (user_select == 5) {
|
||||||
*flags |= SKIP_ALL;
|
*flags |= (SKIP_CUR|SKIP_ALL);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@ -865,7 +871,7 @@ bool PathMove(const char* destdir, const char* orig, u32* flags) {
|
|||||||
strncpy(fopath, orig, 255);
|
strncpy(fopath, orig, 255);
|
||||||
bool same_drv = (PathToNumFS(orig) == PathToNumFS(destdir));
|
bool same_drv = (PathToNumFS(orig) == PathToNumFS(destdir));
|
||||||
bool res = PathCopyWorker(fdpath, fopath, flags, same_drv);
|
bool res = PathCopyWorker(fdpath, fopath, flags, same_drv);
|
||||||
if (res && (!flags || !(*flags&(SKIP_CUR|SKIP_ALL)))) PathDelete(orig);
|
if (res && (!flags || !(*flags&SKIP_CUR))) PathDelete(orig);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user