[Bf-blender-cvs] [b582028b127] master: Correct previously missed case of manual path building in file browser
Julian Eisel
noreply at git.blender.org
Wed Nov 30 20:02:24 CET 2022
Commit: b582028b127aab86028f422c8f30a5e697714c60
Author: Julian Eisel
Date: Wed Nov 30 19:59:26 2022 +0100
Branches: master
https://developer.blender.org/rBb582028b127aab86028f422c8f30a5e697714c60
Correct previously missed case of manual path building in file browser
Missed in 39c9164ea183. Also adds a comments to point at the function
that should be used instead.
===================================================================
M source/blender/editors/space_file/file_draw.c
M source/blender/editors/space_file/filelist.h
M source/blender/makesdna/DNA_space_types.h
===================================================================
diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c
index ed0132c6990..e85a6cbc0d4 100644
--- a/source/blender/editors/space_file/file_draw.c
+++ b/source/blender/editors/space_file/file_draw.c
@@ -907,7 +907,6 @@ void file_draw_list(const bContext *C, ARegion *region)
View2D *v2d = ®ion->v2d;
struct FileList *files = sfile->files;
struct FileDirEntry *file;
- const char *root = filelist_dir(files);
ImBuf *imb;
uiBlock *block = UI_block_begin(C, region, __func__, UI_EMBOSS);
int numfiles;
@@ -988,7 +987,6 @@ void file_draw_list(const bContext *C, ARegion *region)
for (i = offset; (i < numfiles) && (i < offset + numfiles_layout); i++) {
uint file_selflag;
- char path[FILE_MAX_LIBEXTRA];
const int padx = 0.1f * UI_UNIT_X;
int icon_ofs = 0;
@@ -997,7 +995,8 @@ void file_draw_list(const bContext *C, ARegion *region)
file = filelist_file(files, i);
file_selflag = filelist_entry_select_get(sfile->files, file, CHECK_ALL);
- BLI_path_join(path, sizeof(path), root, file->relpath);
+ char path[FILE_MAX_LIBEXTRA];
+ filelist_file_get_full_path(files, file, path);
if (!(file_selflag & FILE_SEL_EDITING)) {
if ((params->highlight_file == i) || (file_selflag & FILE_SEL_HIGHLIGHTED) ||
diff --git a/source/blender/editors/space_file/filelist.h b/source/blender/editors/space_file/filelist.h
index e81a8926eaf..e96ced3fa63 100644
--- a/source/blender/editors/space_file/filelist.h
+++ b/source/blender/editors/space_file/filelist.h
@@ -94,6 +94,10 @@ void filelist_clear_ex(struct FileList *filelist,
void filelist_clear_from_reset_tag(struct FileList *filelist);
void filelist_free(struct FileList *filelist);
+/**
+ * Get the root path of the file list. To get the full path for a file, use
+ * #filelist_file_get_full_path().
+ */
const char *filelist_dir(const struct FileList *filelist);
bool filelist_is_dir(struct FileList *filelist, const char *path);
/**
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index 36c15b6e106..72e39647093 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -1123,7 +1123,8 @@ typedef struct FileDirEntry {
/** ID type, in case typeflag has FILE_TYPE_BLENDERLIB set. */
int blentype;
- /* Path to item that is relative to current folder root. */
+ /* Path to item that is relative to current folder root. To get the full path, use
+ * #filelist_file_get_full_path() */
char *relpath;
/** Optional argument for shortcuts, aliases etc. */
char *redirection_path;
More information about the Bf-blender-cvs
mailing list