Show
Ignore:
Timestamp:
2007-09-05 00:16:36 (15 months ago)
Author:
Rocco Rutte <pdmef@…>
Branch:
HEAD
Message:

Interpret relative paths in browser relative to shown dir, not working
dir (closes #2471).

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • browser.c

    r5138 r5209  
    990990          else 
    991991#endif 
    992           if (stat (buf, &st) == 0) 
    993           { 
    994             if (S_ISDIR (st.st_mode)) 
     992          { 
     993            if (*buf != '/') 
    995994            { 
    996               destroy_state (&state); 
    997               if (examine_directory (menu, &state, buf, prefix) == 0) 
    998                 strfcpy (LastDir, buf, sizeof (LastDir)); 
     995              /* in case dir is relative, make it relative to LastDir, 
     996               * not current working dir */ 
     997              char tmp[_POSIX_PATH_MAX]; 
     998              mutt_concat_path (tmp, LastDir, buf, sizeof (tmp)); 
     999              strfcpy (buf, tmp, sizeof (buf)); 
     1000            } 
     1001            if (stat (buf, &st) == 0) 
     1002            { 
     1003              if (S_ISDIR (st.st_mode)) 
     1004              { 
     1005                destroy_state (&state); 
     1006                if (examine_directory (menu, &state, buf, prefix) == 0) 
     1007                  strfcpy (LastDir, buf, sizeof (LastDir)); 
     1008                else 
     1009                { 
     1010                  mutt_error _("Error scanning directory."); 
     1011                  if (examine_directory (menu, &state, LastDir, prefix) == -1) 
     1012                  { 
     1013                    mutt_menuDestroy (&menu); 
     1014                    goto bail; 
     1015                  } 
     1016                } 
     1017                menu->current = 0; 
     1018                menu->top = 0; 
     1019                init_menu (&state, menu, title, sizeof (title), buffy); 
     1020              } 
    9991021              else 
    1000               { 
    1001                 mutt_error _("Error scanning directory."); 
    1002                 if (examine_directory (menu, &state, LastDir, prefix) == -1) 
    1003                 { 
    1004                   mutt_menuDestroy (&menu); 
    1005                   goto bail; 
    1006                 } 
    1007               } 
    1008               menu->current = 0;  
    1009               menu->top = 0;  
    1010               init_menu (&state, menu, title, sizeof (title), buffy); 
     1022                mutt_error (_("%s is not a directory."), buf); 
    10111023            } 
    10121024            else 
    1013               mutt_error (_("%s is not a directory."), buf); 
    1014           } 
    1015           else 
    1016             mutt_perror (buf); 
     1025              mutt_perror (buf); 
     1026          } 
    10171027        } 
    10181028        MAYBE_REDRAW (menu->redraw);