diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2015-01-26 18:58:02 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2015-01-26 18:59:24 +0300 |
commit | 7bc6fbf158556331e247b714f874b919b9af9ae7 (patch) | |
tree | c5b3c883d6a4243f2f11bbac9306abdee07e1207 /source/blender/editors/space_file/file_ops.c | |
parent | fca515838e70f8bec7028b840bb921a1be9fabbb (diff) |
Cleanup: current/parent paths: add helpers in BLI_path_utils.
Also, avoid calling ugly strcmp with '.' or '..', making direct char checks is
much cheaper here!
Diffstat (limited to 'source/blender/editors/space_file/file_ops.c')
-rw-r--r-- | source/blender/editors/space_file/file_ops.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index 697ac23c84d..ba6f91e8301 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -183,11 +183,11 @@ static FileSelect file_select_do(bContext *C, int selected_idx, bool do_diropen) retval = FILE_SELECT_DIR; } /* the path is too long and we are not going up! */ - else if (!STREQ(file->relname, "..") && strlen(params->dir) + strlen(file->relname) >= FILE_MAX) { + else if (!FILENAME_IS_PARENT(file->relname) && strlen(params->dir) + strlen(file->relname) >= FILE_MAX) { // XXX error("Path too long, cannot enter this directory"); } else { - if (STREQ(file->relname, "..")) { + if (FILENAME_IS_PARENT(file->relname)) { /* avoids /../../ */ BLI_parent_dir(params->dir); } @@ -269,7 +269,7 @@ static int file_border_select_modal(bContext *C, wmOperator *op, const wmEvent * for (idx = sel.last; idx >= 0; idx--) { struct direntry *file = filelist_file(sfile->files, idx); - if (STREQ(file->relname, "..") || STREQ(file->relname, ".")) { + if (FILENAME_IS_CURRPAR(file->relname)) { file->selflag &= ~FILE_SEL_HIGHLIGHTED; } @@ -362,7 +362,7 @@ static int file_select_invoke(bContext *C, wmOperator *op, const wmEvent *event) if (idx >= 0) { struct direntry *file = filelist_file(sfile->files, idx); - if (STREQ(file->relname, "..") || STREQ(file->relname, ".")) { + if (FILENAME_IS_CURRPAR(file->relname)) { /* skip - If a readonly file (".." or ".") is selected, skip deselect all! */ } else { @@ -1531,7 +1531,7 @@ static int file_rename_poll(bContext *C) if (idx >= 0) { struct direntry *file = filelist_file(sfile->files, idx); - if (STREQ(file->relname, "..") || STREQ(file->relname, ".")) { + if (FILENAME_IS_CURRPAR(file->relname)) { poll = 0; } } |