From aa44603146e87f29f08cee2abab7e0ddd89222c5 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 28 Jul 2009 16:46:14 +0000 Subject: 2.5: File browser * Side panels now use list widgets. * Enabled theme colors for side panel. * Add button in bookmarks panel. * Operator panel title now uses operator name. * For unix, added / to system, and home and desktop to bookmarks. * For opening fileselect with filter, cleaned up the code a bit, adding WM_operator_properties_filesel instead of duplicating code. * Also added filter for all operators calling fileselect, only image and file open did it before. * Hide . files by default, and also hide files ending with ~. * Added back .. (but not .) in the file list, I really missed this. * File highlight now only happens when you're actually over a file, instead staying after you move the mouse away. * Fix some redraw/refresh issues. --- source/blender/blenlib/intern/storage.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'source/blender/blenlib') diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c index 817209eaed4..0a416e624cb 100644 --- a/source/blender/blenlib/intern/storage.c +++ b/source/blender/blenlib/intern/storage.c @@ -218,7 +218,7 @@ void BLI_builddir(char *dirname, char *relname) { struct dirent *fname; struct dirlink *dlink; - int rellen, newnum = 0; + int rellen, newnum = 0, len; char buf[256]; DIR *dir; @@ -237,13 +237,11 @@ void BLI_builddir(char *dirname, char *relname) if ( (dir = (DIR *)opendir(".")) ){ while ((fname = (struct dirent*) readdir(dir)) != NULL) { + len= strlen(fname->d_name); - if(hide_dot && fname->d_name[0]=='.' && fname->d_name[1]!='.' && fname->d_name[1]!=0) { - } - else if ( ( (fname->d_name[0] == '.') && (fname->d_name[1] == 0) ) || - ( (fname->d_name[0] == '.') && (fname->d_name[1] == '.') && (fname->d_name[2] == 0)) ) { - /* ignore '.' and '..' */ - } + if(hide_dot && fname->d_name[0]=='.' && fname->d_name[1]!='.' && fname->d_name[1]!=0); /* ignore .file */ + else if(hide_dot && len && fname->d_name[len-1]=='~'); /* ignore file~ */ + else if (((fname->d_name[0] == '.') && (fname->d_name[1] == 0) )); /* ignore . */ else { dlink = (struct dirlink *)malloc(sizeof(struct dirlink)); if (dlink){ -- cgit v1.2.3