Cleanup: avoid changing the filepath for alembic frame range calculation

The internal utility get_sequence_len would make it's filename
argument absolute so as to scan it's directory for files.

Perform this on the directory instead so the filename can be const.
This commit is contained in:
Campbell Barton
2023-04-19 12:33:28 +10:00
parent 643f8bcedd
commit 61fe8da989

View File

@@ -493,7 +493,7 @@ static int cmp_frame(const void *a, const void *b)
return 0;
}
static int get_sequence_len(char *filename, int *ofs)
static int get_sequence_len(const char *filename, int *ofs)
{
int frame;
int numdigit;
@@ -503,13 +503,15 @@ static int get_sequence_len(char *filename, int *ofs)
}
char path[FILE_MAX];
BLI_path_abs(filename, BKE_main_blendfile_path_from_global());
BLI_split_dir_part(filename, path, FILE_MAX);
if (path[0] == '\0') {
/* The filename had no path, so just use the blend file path. */
BLI_split_dir_part(BKE_main_blendfile_path_from_global(), path, FILE_MAX);
}
else {
BLI_path_abs(path, BKE_main_blendfile_path_from_global());
}
DIR *dir = opendir(path);
if (dir == NULL) {