Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/space_file/file_draw.c')
-rw-r--r--source/blender/editors/space_file/file_draw.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c
index 6347ce7c4e8..7a3296d3f3d 100644
--- a/source/blender/editors/space_file/file_draw.c
+++ b/source/blender/editors/space_file/file_draw.c
@@ -157,13 +157,19 @@ void file_draw_buttons(const bContext *C, ARegion *ar)
/* Text input fields for directory and file. */
if (available_w > 0) {
+ const struct direntry *file = filelist_file(sfile->files, params->active_file);
int overwrite_alert = file_draw_check_exists(sfile);
+ const bool is_active_dir = file && BLI_is_dir(file->path);
+ char *dir_path = (is_active_dir && params->active_file > 0) ? file->path : params->dir;
+
+ BLI_add_slash(dir_path);
+
/* callbacks for operator check functions */
UI_block_func_set(block, file_draw_check_cb, NULL, NULL);
but = uiDefBut(block, UI_BTYPE_TEXT, -1, "",
min_x, line1_y, line1_w - chan_offs, btn_h,
- params->dir, 0.0, (float)FILE_MAX, 0, 0,
+ dir_path, 0.0, (float)FILE_MAX, 0, 0,
TIP_("File path"));
UI_but_func_complete_set(but, autocomplete_directory, NULL);
UI_but_flag_enable(but, UI_BUT_NO_UTF8);
@@ -178,7 +184,8 @@ void file_draw_buttons(const bContext *C, ARegion *ar)
if ((params->flag & FILE_DIRSEL_ONLY) == 0) {
but = uiDefBut(block, UI_BTYPE_TEXT, -1, "",
min_x, line2_y, line2_w - chan_offs, btn_h,
- params->file, 0.0, (float)FILE_MAXFILE, 0, 0,
+ is_active_dir ? (char *)"" : params->file,
+ 0.0, (float)FILE_MAXFILE, 0, 0,
TIP_(overwrite_alert ? N_("File name, overwrite existing") : N_("File name")));
UI_but_func_complete_set(but, autocomplete_file, NULL);
UI_but_flag_enable(but, UI_BUT_NO_UTF8);
@@ -216,8 +223,11 @@ void file_draw_buttons(const bContext *C, ARegion *ar)
/* Execute / cancel buttons. */
if (loadbutton) {
+ const struct direntry *file = filelist_file(sfile->files, params->active_file);
+ const char *str_exec = (file && BLI_is_dir(file->path)) ? IFACE_("Open Directory") : params->title;
+
/* params->title is already translated! */
- uiDefButO(block, UI_BTYPE_BUT, "FILE_OT_execute", WM_OP_EXEC_REGION_WIN, params->title,
+ uiDefButO(block, UI_BTYPE_BUT, "FILE_OT_execute", WM_OP_EXEC_REGION_WIN, str_exec,
max_x - loadbutton, line1_y, loadbutton, btn_h, "");
uiDefButO(block, UI_BTYPE_BUT, "FILE_OT_cancel", WM_OP_EXEC_REGION_WIN, IFACE_("Cancel"),
max_x - loadbutton, line2_y, loadbutton, btn_h, "");