Issue #8581: forward-porting file-name fix from `gimp-2-10` branch.

This is a port of commit 57ee6e13ab to the main dev branch.
This commit is contained in:
Jehan 2023-02-13 21:10:18 +01:00
parent dc8121729d
commit e6e73e14c7
1 changed files with 11 additions and 3 deletions

View File

@ -289,7 +289,6 @@ guillotine (GimpImage *image,
GFile *new_file;
gchar *fileextension;
gchar *fileindex;
gint pos;
if (! new_image)
{
@ -317,12 +316,21 @@ guillotine (GimpImage *image,
/* get the position of the file extension - last . in filename */
fileextension = strrchr (new_uri->str, '.');
pos = fileextension - new_uri->str;
if (fileextension)
{
gint pos;
/* Truncate the extension. */
pos = fileextension - new_uri->str;
g_string_truncate (new_uri, pos);
}
/* insert the coordinates before the extension */
g_string_insert (new_uri, pos, fileindex);
g_string_append (new_uri, fileindex);
g_free (fileindex);
g_string_append (new_uri, ".xcf");
new_file = g_file_new_for_uri (new_uri->str);
g_string_free (new_uri, TRUE);