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:
authorJulian Eisel <eiseljulian@gmail.com>2015-07-11 06:20:35 +0300
committerJulian Eisel <eiseljulian@gmail.com>2015-07-11 06:48:02 +0300
commit02b36188737b3e15fe8173dec7a57da7da610922 (patch)
treea3ce6d9dd7e98910c939b2ff88ed5baa412e035d /source/blender/editors/space_file/file_ops.c
parent909fa34c5f8cea52ce5fa469315936c6303f41b1 (diff)
File Browser: Keep file name after changing directory
Actually this was an intentional change in rBaeeb23efa28dc to prevent Blender from trying to open the old file from the new directory. Issue is that this is really bad for saving and basically breaks "Save As". Some more tweaks were needed to make it work like before, so now it keeps the name of the last selected file, but clears it when selecting a folder.
Diffstat (limited to 'source/blender/editors/space_file/file_ops.c')
-rw-r--r--source/blender/editors/space_file/file_ops.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c
index 1b19a8d4d62..c54731cc66c 100644
--- a/source/blender/editors/space_file/file_ops.c
+++ b/source/blender/editors/space_file/file_ops.c
@@ -1265,16 +1265,21 @@ int file_exec(bContext *C, wmOperator *exec_op)
const struct direntry *file = filelist_file(sfile->files, sfile->params->active_file);
char filepath[FILE_MAX];
- BLI_assert(!file || STREQ(file->relname, "..") || STREQ(file->relname, sfile->params->file));
+ /* if file is a directory it should be in sync with params->dir, otherwise
+ * with params->file; file->path might be NULL on link/append */
+ BLI_assert((file == NULL) ||
+ (file->path == NULL) ||
+ (STREQ(file->relname, sfile->params->file)) ||
+ (BLI_is_dir(file->path) && STRPREFIX(file->path, sfile->params->dir)));
/* directory change */
if (file && S_ISDIR(file->type)) {
if (FILENAME_IS_PARENT(file->relname)) {
BLI_parent_dir(sfile->params->dir);
}
- else if (sfile->params->file[0]) {
+ else if (file->relname) {
BLI_cleanup_dir(G.main->name, sfile->params->dir);
- strcat(sfile->params->dir, sfile->params->file);
+ strcat(sfile->params->dir, file->relname);
BLI_add_slash(sfile->params->dir);
}