mirror of
https://github.com/rvtr/GodMode9i.git
synced 2025-11-02 00:11:07 -04:00
Fix crash when copying empty folders + misc formatting fixes (#65)
This commit is contained in:
parent
7e7ae6159a
commit
96b487781a
@ -96,7 +96,7 @@ int fcopy(const char *sourcePath, const char *destinationPath)
|
||||
chdir(sourcePath);
|
||||
vector<DirEntry> dirContents;
|
||||
getDirectoryContents(dirContents);
|
||||
DirEntry* entry = &dirContents.at(1);
|
||||
DirEntry* entry = NULL;
|
||||
|
||||
mkdir(destinationPath, 0777);
|
||||
for (int i = 1; i < ((int)dirContents.size()); i++) {
|
||||
@ -155,7 +155,7 @@ int fcopy(const char *sourcePath, const char *destinationPath)
|
||||
printf ("\x1B[47m"); // Print foreground white color
|
||||
printf ("\x1b[16;0H");
|
||||
printf ("Progress:\n");
|
||||
printf ("%i/%i Bytes ", (int)offset, (int)fsize);
|
||||
printf ("%i/%i Bytes ", (int)offset, (int)fsize);
|
||||
|
||||
// Copy file to destination path
|
||||
numr = fread(copyBuf, 1, copyBufSize, sourceFile);
|
||||
@ -167,7 +167,7 @@ int fcopy(const char *sourcePath, const char *destinationPath)
|
||||
fclose(destinationFile);
|
||||
|
||||
printf ("\x1b[17;0H");
|
||||
printf ("%i/%i Bytes ", (int)fsize, (int)fsize);
|
||||
printf ("%i/%i Bytes ", (int)fsize, (int)fsize);
|
||||
for (int i = 0; i < 30; i++) swiWaitForVBlank();
|
||||
|
||||
return 1;
|
||||
@ -225,7 +225,7 @@ void changeFileAttribs(DirEntry* entry) {
|
||||
printf ("\x1b[%i;18H", 6+cursorScreenPos);
|
||||
printf ((newAttribs & ATTR_ARCHIVE) ? "X" : " ");
|
||||
printf ("\x1b[%i;0H", 11+cursorScreenPos);
|
||||
printf ((currentAttribs==newAttribs) ? "(<A> to continue) " : "(<A> to apply, <B> to cancel)");
|
||||
printf ((currentAttribs==newAttribs) ? "(<A> to continue) " : "(<A> to apply, <B> to cancel)");
|
||||
|
||||
consoleSelect(&topConsole);
|
||||
printf ("\x1B[30m"); // Print black color
|
||||
|
||||
@ -247,7 +247,7 @@ int fileBrowse_A(DirEntry* entry, char path[PATH_MAX]) {
|
||||
}
|
||||
maxCursors++;
|
||||
assignedOp[maxCursors] = 4;
|
||||
printf(entry->isDirectory ? " Show directory info\n" : " Show file info\n");
|
||||
printf(entry->isDirectory ? " Show directory info\n" : " Show file info\n");
|
||||
if (sdMounted && (strcmp (path, "sd:/gm9i/out/") != 0)) {
|
||||
maxCursors++;
|
||||
assignedOp[maxCursors] = 1;
|
||||
@ -313,7 +313,7 @@ int fileBrowse_A(DirEntry* entry, char path[PATH_MAX]) {
|
||||
char destPath[256];
|
||||
snprintf(destPath, sizeof(destPath), "sd:/gm9i/out/%s", entry->name.c_str());
|
||||
iprintf ("\x1b[%d;3H", optionOffset + OPTIONS_ENTRIES_START_ROW+cursorScreenPos);
|
||||
printf("Copying... ");
|
||||
printf("Copying... ");
|
||||
remove(destPath);
|
||||
char sourceFolder[PATH_MAX];
|
||||
getcwd(sourceFolder, PATH_MAX);
|
||||
@ -335,7 +335,7 @@ int fileBrowse_A(DirEntry* entry, char path[PATH_MAX]) {
|
||||
char destPath[256];
|
||||
snprintf(destPath, sizeof(destPath), "fat:/gm9i/out/%s", entry->name.c_str());
|
||||
iprintf ("\x1b[%d;3H", optionOffset + OPTIONS_ENTRIES_START_ROW+cursorScreenPos);
|
||||
printf("Copying... ");
|
||||
printf("Copying... ");
|
||||
remove(destPath);
|
||||
char sourceFolder[PATH_MAX];
|
||||
getcwd(sourceFolder, PATH_MAX);
|
||||
@ -427,7 +427,7 @@ bool fileBrowse_paste(char dest[256]) {
|
||||
if (pressed & KEY_A) {
|
||||
char destPath[256];
|
||||
iprintf ("\x1b[%d;3H", optionOffset + OPTIONS_ENTRIES_START_ROW);
|
||||
printf(optionOffset ? "Moving..." : "Copying...");
|
||||
printf(optionOffset ? "Moving... " : "Copying...");
|
||||
for (auto it = clipboard.begin(); it != clipboard.end(); ++it) {
|
||||
snprintf(destPath, sizeof(destPath), "%s%s", dest, it->name);
|
||||
if (!strcmp (it->path, destPath))
|
||||
@ -657,7 +657,7 @@ string browseForFile (void) {
|
||||
// Rename file/folder
|
||||
if ((held & KEY_R) && (pressed & KEY_X) && (strcmp (entry->name.c_str(), "..") != 0) && (strncmp (path, "nitro:/", 7) != 0)) {
|
||||
printf ("\x1b[0;27H");
|
||||
printf (" "); // Clear time
|
||||
printf (" "); // Clear time
|
||||
pressed = 0;
|
||||
consoleDemoInit();
|
||||
Keyboard *kbd = keyboardDemoInit();
|
||||
@ -772,7 +772,7 @@ string browseForFile (void) {
|
||||
// Create new folder
|
||||
if ((held & KEY_R) && (pressed & KEY_Y) && (strncmp (path, "nitro:/", 7) != 0)) {
|
||||
printf ("\x1b[0;27H");
|
||||
printf (" "); // Clear time
|
||||
printf (" "); // Clear time
|
||||
pressed = 0;
|
||||
consoleDemoInit();
|
||||
Keyboard *kbd = keyboardDemoInit();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user