Show
Ignore:
Timestamp:
2000-09-13 02:47:54 (8 years ago)
Author:
Thomas Roessler <roessler@…>
Branch:
HEAD
Message:

Let the browser handle non-existent directories more gracefully.
From Byrial Jensen.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • browser.c

    r2103 r2118  
    3535#include <unistd.h> 
    3636#include <sys/stat.h> 
     37#include <errno.h> 
    3738 
    3839static struct mapping_t FolderHelp[] = { 
     
    344345 
    345346static int examine_directory (MUTTMENU *menu, struct browser_state *state, 
    346                               const char *d, const char *prefix) 
     347                              char *d, const char *prefix) 
    347348{ 
    348349  struct stat s; 
     
    352353  BUFFY *tmp; 
    353354 
    354   if (stat (d, &s) == -1) 
    355   { 
     355  while (stat (d, &s) == -1) 
     356  { 
     357    if (errno == ENOENT) 
     358    { 
     359      /* The last used directory is deleted, try to use the parent dir. */ 
     360      char *c = strrchr (d, '/'); 
     361 
     362      if (c && (c > d)) 
     363      { 
     364        *c = 0; 
     365        continue; 
     366      } 
     367    } 
    356368    mutt_perror (d); 
    357369    return (-1);