Hi PixLab,
I gave it a try on linux. Ran your script on image /home/teapot/test.xcf with export directory /home/teapot/Desktop/
With 'Keep the original name' un-ticked got newFileName /home/teapot/Desktop/IMAGE-0000001.webp which looks OK.
With 'Keep the original name' ticked got newFileName /home/teapot/Desktop//home/teapot/test.xcf.webp
This is not OK, the path is in 'twice' and there's a .xcf.
gimp-image-get-filename gives the whole path so /home/teapot/test.xcf
Whereas presumably what you want is gimp-image-get-name which will give test.xcf
Then you would need to strip off the .xcf
Also you should consider the case when the user has a brand new .xcf file that's never been saved.
Any reason why you aren't using python?
I gave it a try on linux. Ran your script on image /home/teapot/test.xcf with export directory /home/teapot/Desktop/
With 'Keep the original name' un-ticked got newFileName /home/teapot/Desktop/IMAGE-0000001.webp which looks OK.
With 'Keep the original name' ticked got newFileName /home/teapot/Desktop//home/teapot/test.xcf.webp
This is not OK, the path is in 'twice' and there's a .xcf.
gimp-image-get-filename gives the whole path so /home/teapot/test.xcf
Whereas presumably what you want is gimp-image-get-name which will give test.xcf
Then you would need to strip off the .xcf
Also you should consider the case when the user has a brand new .xcf file that's never been saved.
Any reason why you aren't using python?