[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [32032] trunk/blender/source/blender/ editors/space_buttons/buttons_ops.c: Fix #23917: selecting a directory with the file browser didn't append
Brecht Van Lommel
brechtvanlommel at pandora.be
Mon Sep 20 23:11:38 CEST 2010
Revision: 32032
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=32032
Author: blendix
Date: 2010-09-20 23:11:38 +0200 (Mon, 20 Sep 2010)
Log Message:
-----------
Fix #23917: selecting a directory with the file browser didn't append
a slash, which is necessary for e.g. render file ouput.
Modified Paths:
--------------
trunk/blender/source/blender/editors/space_buttons/buttons_ops.c
Modified: trunk/blender/source/blender/editors/space_buttons/buttons_ops.c
===================================================================
--- trunk/blender/source/blender/editors/space_buttons/buttons_ops.c 2010-09-20 19:57:14 UTC (rev 32031)
+++ trunk/blender/source/blender/editors/space_buttons/buttons_ops.c 2010-09-20 21:11:38 UTC (rev 32032)
@@ -33,8 +33,12 @@
#include "DNA_userdef_types.h"
#include "BLI_fileops.h"
+#include "BLI_path_util.h"
+#include "BLI_storage.h"
+#include "BLI_string.h"
#include "BKE_context.h"
+#include "BKE_global.h"
#include "WM_api.h"
#include "WM_types.h"
@@ -89,12 +93,28 @@
static int file_browse_exec(bContext *C, wmOperator *op)
{
FileBrowseOp *fbo= op->customdata;
- char *str;
+ ID *id;
+ char *base, *str, path[FILE_MAX];
if (RNA_property_is_set(op->ptr, "filepath")==0 || fbo==NULL)
return OPERATOR_CANCELLED;
str= RNA_string_get_alloc(op->ptr, "filepath", 0, 0);
+
+ /* add slash for directories, important for some properties */
+ if(RNA_property_subtype(fbo->prop) == PROP_DIRPATH) {
+ id = fbo->ptr.id.data;
+ base = (id && id->lib)? id->lib->filepath: G.sce;
+
+ BLI_strncpy(path, str, FILE_MAX);
+ BLI_path_abs(path, base);
+
+ if(BLI_is_dir(path)) {
+ str = MEM_reallocN(str, strlen(str)+2);
+ BLI_add_slash(str);
+ }
+ }
+
RNA_property_string_set(&fbo->ptr, fbo->prop, str);
RNA_property_update(C, &fbo->ptr, fbo->prop);
MEM_freeN(str);
More information about the Bf-blender-cvs
mailing list