[Bf-blender-cvs] [b444887] master: Fix T44243: File browser behavior is inconsistent between append and open.

Bastien Montagne noreply at git.blender.org
Fri Apr 3 16:20:36 CEST 2015


Commit: b444887054297d83c560e860219a5c598d390935
Author: Bastien Montagne
Date:   Fri Apr 3 16:17:17 2015 +0200
Branches: master
https://developer.blender.org/rBb444887054297d83c560e860219a5c598d390935

Fix T44243: File browser behavior is inconsistent between append and open.

Only basic fix, the whole 'dir' field handling needs rework to correctly support
lib stuff (will be done as part of asset-experiment rewriting work)...

All this code is doing way too much filesystem inspection by itself, instead of
reusing flielist.c work - this is stupid, and will completely break with future
asset engines!

===================================================================

M	source/blender/editors/space_file/filesel.c

===================================================================

diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c
index 14b72eb..6858f53 100644
--- a/source/blender/editors/space_file/filesel.c
+++ b/source/blender/editors/space_file/filesel.c
@@ -642,8 +642,8 @@ int file_select_match(struct SpaceFile *sfile, const char *pattern, char *matche
 	 */
 	for (i = 0; i < n; i++) {
 		file = filelist_file(sfile->files, i);
-		/* use same rule as 'FileCheckType.CHECK_FILES' */
-		if (S_ISREG(file->type) && (fnmatch(pattern, file->relname, 0) == 0)) {
+		/* Do not check wether file is a file or dir here! Causes T44243 (we do accept dirs at this stage). */
+		if (fnmatch(pattern, file->relname, 0) == 0) {
 			file->selflag |= FILE_SEL_SELECTED;
 			if (!match) {
 				BLI_strncpy(matched_file, file->relname, FILE_MAX);
@@ -694,13 +694,8 @@ int autocomplete_directory(struct bContext *C, char *str, void *UNUSED(arg_v))
 			closedir(dir);
 
 			match = UI_autocomplete_end(autocpl, str);
-			if (match) {
-				if (match == AUTOCOMPLETE_FULL_MATCH) {
-					BLI_add_slash(str);
-				}
-				else {
-					BLI_strncpy(sfile->params->dir, str, sizeof(sfile->params->dir));
-				}
+			if (match == AUTOCOMPLETE_FULL_MATCH) {
+				BLI_add_slash(str);
 			}
 		}
 	}




More information about the Bf-blender-cvs mailing list