diff options
author | Andrea Weikert <elubie@gmx.net> | 2009-07-10 21:05:04 +0400 |
---|---|---|
committer | Andrea Weikert <elubie@gmx.net> | 2009-07-10 21:05:04 +0400 |
commit | 66ca86b40b7f4f66f46572ca218e522d5bbf7919 (patch) | |
tree | 89df818c6c0e74c702ca14d29d7df19e870e3b99 /source/blender/editors/space_file/filesel.c | |
parent | 8f602277503361c1f0e0f53f3c99fdc3fa8b2d1c (diff) |
2.5 file browser
* directory button enabled again, c code for now, can later become nicer operator
* filename button enabled (pattern match for selection)
* RNA completed (title, file and directory)
* some unused code removal.
Diffstat (limited to 'source/blender/editors/space_file/filesel.c')
-rw-r--r-- | source/blender/editors/space_file/filesel.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c index c42c83eda98..be5feb45b4e 100644 --- a/source/blender/editors/space_file/filesel.c +++ b/source/blender/editors/space_file/filesel.c @@ -80,6 +80,17 @@ #include "file_intern.h" #include "filelist.h" +#if defined __BeOS +static int fnmatch(const char *pattern, const char *string, int flags) +{ + return 0; +} +#elif defined WIN32 && !defined _LIBC + /* use fnmatch included in blenlib */ + #include "BLI_fnmatch.h" +#else + #include <fnmatch.h> +#endif FileSelectParams* ED_fileselect_get_params(struct SpaceFile *sfile) { @@ -299,3 +310,22 @@ void file_change_dir(struct SpaceFile *sfile) sfile->params->active_file = -1; } } + +int file_select_match(struct SpaceFile *sfile, const char *pattern) +{ + int match = 0; + if (strchr(pattern, '*') || strchr(pattern, '?') || strchr(pattern, '[')) { + int i; + struct direntry *file; + int n = filelist_numfiles(sfile->files); + + for (i = 0; i < n; i++) { + file = filelist_file(sfile->files, i); + if (fnmatch(pattern, file->relname, 0) == 0) { + file->flags |= ACTIVE; + match = 1; + } + } + } + return match; +} |