Cleanup: replace BLI_make_file_string with BLI_join_dirfile for the file-selector

In these cases the file selectors directory is already expanded.
This commit is contained in:
Campbell Barton 2020-03-07 13:49:58 +11:00
parent 0964865568
commit ef5c6361a5
Notes: blender-bot 2023-02-14 11:07:28 +01:00
Referenced by issue #74881, Plane track corners can't be edited independently
2 changed files with 6 additions and 10 deletions

View File

@ -386,11 +386,10 @@ static void renamebutton_cb(bContext *C, void *UNUSED(arg1), char *oldname)
ScrArea *sa = CTX_wm_area(C);
ARegion *region = CTX_wm_region(C);
const char *blendfile_path = BKE_main_blendfile_path(bmain);
BLI_make_file_string(blendfile_path, orgname, sfile->params->dir, oldname);
BLI_join_dirfile(orgname, sizeof(orgname), sfile->params->dir, oldname);
BLI_strncpy(filename, sfile->params->renamefile, sizeof(filename));
BLI_filename_make_safe(filename);
BLI_make_file_string(blendfile_path, newname, sfile->params->dir, filename);
BLI_join_dirfile(newname, sizeof(newname), sfile->params->dir, filename);
if (!STREQ(orgname, newname)) {
if (!BLI_exists(newname)) {

View File

@ -2489,22 +2489,19 @@ static bool file_delete_poll(bContext *C)
int file_delete_exec(bContext *C, wmOperator *op)
{
char str[FILE_MAX];
Main *bmain = CTX_data_main(C);
wmWindowManager *wm = CTX_wm_manager(C);
SpaceFile *sfile = CTX_wm_space_file(C);
ScrArea *sa = CTX_wm_area(C);
FileDirEntry *file;
int numfiles = filelist_files_ensure(sfile->files);
int i;
const char *error_message = NULL;
bool report_error = false;
errno = 0;
for (i = 0; i < numfiles; i++) {
for (int i = 0; i < numfiles; i++) {
if (filelist_entry_select_index_get(sfile->files, i, CHECK_ALL)) {
file = filelist_file(sfile->files, i);
BLI_make_file_string(BKE_main_blendfile_path(bmain), str, sfile->params->dir, file->relpath);
FileDirEntry *file = filelist_file(sfile->files, i);
char str[FILE_MAX];
BLI_join_dirfile(str, sizeof(str), sfile->params->dir, file->relpath);
if (BLI_delete_soft(str, &error_message) != 0 || BLI_exists(str)) {
report_error = true;
}