Diff of /trunk/src/misc.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 34 by harbaum, Wed Jul 29 19:24:15 2009 UTC revision 77 by harbaum, Tue Aug 25 12:49:03 2009 UTC
# Line 21  Line 21 
21  #include <string.h>  #include <string.h>
22  #include <ctype.h>  #include <ctype.h>
23    
24    #include <glib.h>
25    #include <glib/gstdio.h>
26    
27  #include "gpxview.h"  #include "gpxview.h"
28    
29  char strlastchr(char *str) {  char strlastchr(char *str) {
# Line 385  int browser_url(appdata_t *appdata, char Line 388  int browser_url(appdata_t *appdata, char
388  }  }
389  #endif  #endif
390  #endif  #endif
391    
392    /* recursively remove an entire file system */
393    void rmdir_recursive(char *path) {
394      GDir *dir = g_dir_open(path, 0, NULL);
395      if(dir) {
396        const char *name = g_dir_read_name(dir);
397        while(name) {
398          char *fullname = g_strdup_printf("%s/%s", path, name);
399          //      printf("deleting %s\n", fullname);
400    
401          if(g_file_test(fullname, G_FILE_TEST_IS_DIR))
402            rmdir_recursive(fullname);
403          else if(g_file_test(fullname, G_FILE_TEST_IS_REGULAR))
404            g_remove(fullname);
405    
406          g_free(fullname);
407          name = g_dir_read_name(dir);
408        }
409    
410        g_dir_close(dir);
411      }
412      g_rmdir(path);
413    }
414    

Legend:
Removed from v.34  
changed lines
  Added in v.77