Fix #120253: Batch export of STL files incorrectly handles .stl suffix
When path to export is in the form if "/some/folder/.stl", any regular path functions (BLI_path_suffix, BLI_path_extension_replace etc.) would not treat it as having ".stl" extension, but rather as a hidden file called ".stl". And so BLI_path_suffix would turn it into "/some/folder/.stlCube". To prevent this, detect this exact case when the whole basename is just ".stl", and remove the ".stl" part before using other path functions. Pull Request: https://projects.blender.org/blender/blender/pulls/125179
This commit is contained in:
committed by
Aras Pranckevicius
parent
686e22bfe5
commit
fe1bf4897d
@@ -85,6 +85,14 @@ void export_frame(Depsgraph *depsgraph,
|
||||
/* Include object name in the exported file name. */
|
||||
char filepath[FILE_MAX];
|
||||
STRNCPY(filepath, export_params.filepath);
|
||||
/* When basename is just ".stl", regular path functions would
|
||||
* treat it as a hidden file called ".stl". Remove the extension
|
||||
* before trying to add a suffix. */
|
||||
const char *basename = BLI_path_basename(filepath);
|
||||
if (basename != nullptr && BLI_strcasecmp(basename, ".stl") == 0) {
|
||||
*const_cast<char *>(basename) = '\0';
|
||||
}
|
||||
|
||||
BLI_path_suffix(filepath, FILE_MAX, object_name, "");
|
||||
/* Make sure we have `.stl` extension (case insensitive). */
|
||||
if (!BLI_path_extension_check(filepath, ".stl")) {
|
||||
|
||||
Reference in New Issue
Block a user