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

View File

@ -1311,8 +1311,11 @@ static const char *menu_select_file_internal(char *dir_path,
{
free((void*)sel);
updir=strrchr(dir_path,'/');
if ((updir!=NULL)&&(updir!=dir_path)) // or "/" and not root dir
*updir=0; //trunk dir_path at last /
if (updir!=NULL) // found "/"
{
*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);
}