Index: apps/tree.c =================================================================== RCS file: /cvsroot/rockbox/apps/tree.c,v retrieving revision 1.226 diff -u -r1.226 tree.c --- apps/tree.c 21 Jan 2004 14:58:40 -0000 1.226 +++ apps/tree.c 24 Jan 2004 11:26:25 -0000 @@ -78,6 +78,7 @@ { ".cfg", TREE_ATTR_CFG, Config }, { ".wps", TREE_ATTR_WPS, Wps, }, { ".txt", TREE_ATTR_TXT, Text }, + { ".lnk", TREE_ATTR_LNK, Folder }, { ".lng", TREE_ATTR_LNG, Language }, { ".rock",TREE_ATTR_ROCK,Plugin }, #ifdef HAVE_LCD_BITMAP @@ -116,10 +117,12 @@ static char lastdir[MAX_PATH]; static char lastfile[MAX_PATH]; static char currdir[MAX_PATH]; +static char currdirbeforelnk[MAX_PATH]; static char currdir_save[MAX_PATH]; static bool reload_dir = false; static int boot_size = 0; static int boot_cluster; +static int inlnkdir; static bool boot_changed = false; static bool start_wps = false; @@ -848,6 +851,9 @@ bool update_all = false; /* set this to true when the whole file list has been refreshed on screen */ + char global_read_link_buffer[1024]; + int fd; + #ifdef HAVE_LCD_BITMAP int fw, fh; lcd_setfont(FONT_UI); @@ -912,6 +918,7 @@ #ifdef HAVE_RECORDER_KEYPAD case BUTTON_LEFT | BUTTON_REPEAT: #endif + i=strlen(currdir); if (i>1) { while (currdir[i-1]!='/') @@ -922,6 +929,17 @@ else currdir[i-1]=0; + /* + splash(HZ*4, true, currdirbeforelnk); + splash(HZ*4, true, currdir); + splash(HZ*4, true, buf); + */ + + if (inlnkdir) { + inlnkdir = 0; + memcpy(currdir,currdirbeforelnk,sizeof(currdir)); + } + dirlevel--; if ( dirlevel < MAX_DIR_LEVELS ) { dirstart = dirpos[dirlevel]; @@ -1084,6 +1102,33 @@ case TREE_ATTR_TXT: plugin_load("/.rockbox/rocks/viewer.rock",buf); restore = true; + break; + + case TREE_ATTR_LNK: + fd = open(buf, O_RDONLY); + + if(fd >= 0) + { + if(read_line(fd, global_read_link_buffer, sizeof(global_read_link_buffer))) + { + inlnkdir = 1; + memcpy(currdirbeforelnk,currdir,sizeof(currdirbeforelnk)); + + //splash(HZ*4, true, global_read_link_buffer); + memcpy(currdir,global_read_link_buffer,sizeof(currdir)); + if ( dirlevel < MAX_DIR_LEVELS ) { + dirpos[dirlevel] = dirstart; + cursorpos[dirlevel] = dircursor; + } + dirlevel++; + dircursor=0; + dirstart=0; + + restore = true; + } + } + close(fd); + break; case TREE_ATTR_LNG: Index: apps/tree.h =================================================================== RCS file: /cvsroot/rockbox/apps/tree.h,v retrieving revision 1.14 diff -u -r1.14 tree.h --- apps/tree.h 21 Jan 2004 14:58:40 -0000 1.14 +++ apps/tree.h 24 Jan 2004 11:26:25 -0000 @@ -40,6 +40,7 @@ #define TREE_ATTR_CH8 0x0B00 /* chip-8 game */ #define TREE_ATTR_RVF 0x0C00 /* rockbox video file */ #define TREE_ATTR_BMARK 0x0D00 /* book mark file */ +#define TREE_ATTR_LNK 0x0E00 /* book mark file */ #define TREE_ATTR_MASK 0xFFC0 /* which bits tree.c uses (above) */ void tree_init(void);