Fixed bug in dir browsing, fixed check on device selection

This commit is contained in:
fabio.olimpieri 2013-01-18 19:18:28 +00:00
parent e68cedeed9
commit e61c87570c
2 changed files with 37 additions and 15 deletions

View File

@ -1143,7 +1143,7 @@ int main(int argc,char *argv[]) {
if (fatInitDefault()) if (fatInitDefault())
printf("FAT subsytem initialized\n"); printf("FAT subsytem initialized\n");
else else
printf("Couldn't initialize fat subsytem\n"); printf("Couldn't initialize FAT subsytem\n");
DIR *dp; DIR *dp;
@ -1379,21 +1379,40 @@ int main(int argc,char *argv[]) {
else {printf("Can't make tmp directory\n"); tmpismade=0;} else {printf("Can't make tmp directory\n"); tmpismade=0;}
#ifdef GEKKO #ifdef GEKKO
if ((ordenador.port==1)&&sdismount) { switch (ordenador.port)
strcpy(path_snaps,"sd:/"); {
strcpy(path_taps,"sd:/"); case 1: //SD
if (sdismount)
{
strcpy(path_snaps,"sd:/");
strcpy(path_taps,"sd:/");
} }
if ((ordenador.port==2)&&usbismount) { else ordenador.port =0;
strcpy(path_snaps,"usb:/"); break;
strcpy(path_taps,"usb:/"); case 2: //USB
if (usbismount)
{
strcpy(path_snaps,"usb:/");
strcpy(path_taps,"usb:/");
} }
if ((ordenador.port==3)&&smbismount) { else ordenador.port =0;
strcpy(path_snaps,"smb:/"); break;
strcpy(path_taps,"smb:/"); case 3: //SMB
if (smbismount)
{
strcpy(path_snaps,"smb:/");
strcpy(path_taps,"smb:/");
} }
if ((ordenador.port==4)&&ftpismount) { else ordenador.port =0;
strcpy(path_snaps,"ftp:"); break;
strcpy(path_taps,"ftp:"); case 4: //FTP
if (ftpismount)
{
strcpy(path_snaps,"ftp:");
strcpy(path_taps,"ftp:");
}
else ordenador.port =0;
break;
} }
#endif #endif

View File

@ -1311,8 +1311,11 @@ static const char *menu_select_file_internal(char *dir_path,
{ {
free((void*)sel); free((void*)sel);
updir=strrchr(dir_path,'/'); updir=strrchr(dir_path,'/');
if ((updir!=NULL)&&(updir!=dir_path)) // or "/" and not root dir if (updir!=NULL) // found "/"
*updir=0; //trunk dir_path at last / {
*updir=0; //trunk dir_path at last /
if (strrchr(dir_path,'/')==NULL) {*updir='/'; *(updir+1)=0;} //check if it was root
}
return menu_select_file(dir_path, selected_file, draw_scr); return menu_select_file(dir_path, selected_file, draw_scr);
} }