diff --git a/source/blender/editors/space_file/file_ops.cc b/source/blender/editors/space_file/file_ops.cc index 2a80a46f8c2..f7f4568d1a2 100644 --- a/source/blender/editors/space_file/file_ops.cc +++ b/source/blender/editors/space_file/file_ops.cc @@ -1597,19 +1597,23 @@ void file_sfile_to_operator_ex( { FileSelectParams *params = ED_fileselect_get_active_params(sfile); PropertyRNA *prop; + char dir[FILE_MAX]; + + BLI_strncpy(dir, params->dir, FILE_MAX); + BLI_path_slash_ensure(dir, FILE_MAX); /* XXX, not real length */ if (params->file[0]) { BLI_path_join(filepath, FILE_MAX, params->dir, params->file); } else { - BLI_strncpy(filepath, params->dir, FILE_MAX); - BLI_path_slash_ensure(filepath, FILE_MAX); + BLI_strncpy(filepath, dir, FILE_MAX); } if ((prop = RNA_struct_find_property(op->ptr, "relative_path"))) { if (RNA_property_boolean_get(op->ptr, prop)) { BLI_path_rel(filepath, BKE_main_blendfile_path(bmain)); + BLI_path_rel(dir, BKE_main_blendfile_path(bmain)); } } @@ -1623,8 +1627,8 @@ void file_sfile_to_operator_ex( } if ((prop = RNA_struct_find_property(op->ptr, "directory"))) { RNA_property_string_get(op->ptr, prop, value); - RNA_property_string_set(op->ptr, prop, params->dir); - if (RNA_property_update_check(prop) && !STREQ(params->dir, value)) { + RNA_property_string_set(op->ptr, prop, dir); + if (RNA_property_update_check(prop) && !STREQ(dir, value)) { RNA_property_update(C, op->ptr, prop); } }