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.
This commit is contained in:
Julian Eisel 2021-10-11 18:26:31 +02:00
parent db851ccd2a
commit d993c7b503
1 changed files with 4 additions and 4 deletions

View File

@ -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",