If I have an icon and I want to export it to a png set, two issues are occuring:
-
If I want to save the png exports to the same directory, I’m asked if I want to overwrite the original, but the export files are supposed to have different filenames (MyIcon becomes MyIcon_{64|16|32}.png). Confirming this will not overwrite the original file at all.
-
If the filename is too long, it will be truncated without appending the proper extension, resulting in the exported filenames all being the same. So Instead of LONGNAME being saved to TRUNCATED_{64|16|32}.png there is only 1 file with a truncated name. The issue is in the file src/apps/icon-o-matic/document/savers/BitmapSetSaver.cpp, with a potential fix like this:
--- a/src/apps/icon-o-matic/document/savers/BitmapSetSaver.cpp
+++ b/src/apps/icon-o-matic/document/savers/BitmapSetSaver.cpp
@@ -28,24 +28,28 @@
BitmapSetSaver::Save(Document* document)
{
entry_ref actualRef(fRef);
- char name[B_OS_NAME_LENGTH];
+ size_t size = B_OS_NAME_LENGTH;
+ char name[size];
// 64x64
- snprintf(name, sizeof(name), "%s_64.png", fRef.name);
+ snprintf(name, size-7, "%s", fRef.name);
+ snprintf(name, size, "%s_64.png", name);
actualRef.set_name(name);
Exporter* exporter = new BitmapExporter(64);
exporter->SetSelfDestroy(true);
exporter->Export(document, actualRef);
// 16x16
- snprintf(name, sizeof(name), "%s_16.png", fRef.name);
+ snprintf(name, size-7, "%s", fRef.name);
+ snprintf(name, size, "%s_16.png", name);
actualRef.set_name(name);
exporter = new BitmapExporter(16);
exporter->SetSelfDestroy(true);
exporter->Export(document, actualRef);
// 32x32
- snprintf(name, sizeof(name), "%s_32.png", fRef.name);
+ snprintf(name, size-7, "%s", fRef.name);
+ snprintf(name, size, "%s_32.png", name);
actualRef.set_name(name);
exporter = new BitmapExporter(32);
exporter->SetSelfDestroy(true);
By the way B_OS_NAME_LENGTH is defined as 32 which is not very long in opinion.