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!
This commit is contained in:
Bastien Montagne 2015-04-03 16:17:17 +02:00
parent 3f30ebf64a
commit b444887054
Notes: blender-bot 2023-06-12 00:52:52 +02:00
Referenced by issue #44275, Using "Ctrl" to acquire snap target and left-click to confirm is broken since the sticky-keys commit
Referenced by issue #44243, File browser behavior is inconsistent between append and open
1 changed files with 4 additions and 9 deletions

View File

@ -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);
}
}
}