diff options
author | Julian Eisel <julian@blender.org> | 2021-10-11 19:26:31 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2021-10-11 19:28:34 +0300 |
commit | d993c7b50300a588eb909e9e02b0735f2cb8f11b (patch) | |
tree | 1f6a9bc9a66956a0d92ce3af3a9a27d7bb159f6e /source/blender | |
parent | db851ccd2a896f3f058dba56a5380fb2bf1ae0f9 (diff) |
Fix recently added File Browser name/path getters not allowing unicode
The `FileSelectEntry.name` and `FileSelectEntry.relative_path` members
should support unicode strings like any file names & paths, but didn't.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/makesrna/intern/rna_space.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index fcaf53da81b..8a2f48ba991 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -2652,7 +2652,7 @@ static int rna_FileBrowser_FileSelectEntry_name_editable(PointerRNA *ptr, const static void rna_FileBrowser_FileSelectEntry_name_get(PointerRNA *ptr, char *value) { const FileDirEntry *entry = ptr->data; - strcpy(value, entry->name); + BLI_strncpy_utf8(value, entry->name, strlen(entry->name) + 1); } static int rna_FileBrowser_FileSelectEntry_name_length(PointerRNA *ptr) @@ -2664,7 +2664,7 @@ static int rna_FileBrowser_FileSelectEntry_name_length(PointerRNA *ptr) static void rna_FileBrowser_FileSelectEntry_relative_path_get(PointerRNA *ptr, char *value) { const FileDirEntry *entry = ptr->data; - strcpy(value, entry->relpath); + BLI_strncpy_utf8(value, entry->relpath, strlen(entry->relpath) + 1); } static int rna_FileBrowser_FileSelectEntry_relative_path_length(PointerRNA *ptr) @@ -6344,7 +6344,7 @@ static void rna_def_fileselect_entry(BlenderRNA *brna) RNA_def_struct_sdna(srna, "FileDirEntry"); RNA_def_struct_ui_text(srna, "File Select Entry", "A file viewable in the File Browser"); - prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); + prop = RNA_def_property(srna, "name", PROP_STRING, PROP_FILENAME); RNA_def_property_editable_func(prop, "rna_FileBrowser_FileSelectEntry_name_editable"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_string_funcs(prop, @@ -6354,7 +6354,7 @@ static void rna_def_fileselect_entry(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Name", ""); RNA_def_struct_name_property(srna, prop); - prop = RNA_def_property(srna, "relative_path", PROP_STRING, PROP_NONE); + prop = RNA_def_property(srna, "relative_path", PROP_STRING, PROP_FILEPATH); RNA_def_property_string_funcs(prop, "rna_FileBrowser_FileSelectEntry_relative_path_get", "rna_FileBrowser_FileSelectEntry_relative_path_length", |