diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-08-26 05:32:07 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-08-26 05:32:07 +0400 |
commit | 566da261737731a2e58e8e3ab489c2823068ef2b (patch) | |
tree | e9c589ab3b7cd9df467c69e515f2def34d4efd81 /source/blender/editors/space_file/file_ops.c | |
parent | 291ae8822d5ff2fafbb53568c040828058cee0db (diff) |
file-selector: when converting operator arguments to the file selector, wasnt making paths absolute (abs paths are made relative when converting the other way).
Diffstat (limited to 'source/blender/editors/space_file/file_ops.c')
-rw-r--r-- | source/blender/editors/space_file/file_ops.c | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index a34335a031d..1b0893e50e0 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -657,25 +657,27 @@ void file_sfile_to_operator(wmOperator *op, SpaceFile *sfile, char *filepath) void file_operator_to_sfile(SpaceFile *sfile, wmOperator *op) { - int change= FALSE; - if(RNA_struct_find_property(op->ptr, "filename")) { - RNA_string_get(op->ptr, "filename", sfile->params->file); - change= TRUE; - } - if(RNA_struct_find_property(op->ptr, "directory")) { - RNA_string_get(op->ptr, "directory", sfile->params->dir); - change= TRUE; - } - + PropertyRNA *prop; + /* If neither of the above are set, split the filepath back */ - if(RNA_struct_find_property(op->ptr, "filepath")) { - if(change==FALSE) { - char filepath[FILE_MAX]; - RNA_string_get(op->ptr, "filepath", filepath); - BLI_split_dirfile(filepath, sfile->params->dir, sfile->params->file); + if((prop= RNA_struct_find_property(op->ptr, "filepath"))) { + char filepath[FILE_MAX]; + RNA_property_string_get(op->ptr, prop, filepath); + BLI_split_dirfile(filepath, sfile->params->dir, sfile->params->file); + } + else { + if((prop= RNA_struct_find_property(op->ptr, "filename"))) { + RNA_property_string_get(op->ptr, prop, sfile->params->file); + } + if((prop= RNA_struct_find_property(op->ptr, "directory"))) { + RNA_property_string_get(op->ptr, prop, sfile->params->dir); } } + /* we could check for relative_path property which is used when converting + * in the other direction but doesnt hurt to do this every time */ + BLI_path_abs(sfile->params->dir, G.main->name); + /* XXX, files and dirs updates missing, not really so important though */ } |