Before this commit, if the user tried to import a resource file that is incorrect (cannot be loaded for any reason), Krita would still leave the incorrect file in the resource folder. While it could potentially have some uses (for example the user is importing a resource file that works with a different version of Krita, or with different plugins), usually it's unneeded and the file imported is indeed in incorrect file format etc.
This commit ensures that if the freshly imported resource file cannot be loaded, it is removed.
- Create a file called
pattern.png~(can be an image file or not)
- Import it before my MR.
- See that it's in the
/patterns/folder despite Krita saying that the import failed (because Krita can't read that file)
- Remove that file
- Switch to the MR version
- Import the file
- See that it's nowhere to be seen in
I confirmed this builds.
I confirmed Krita ran and the relevant functions work.
I tested the relevant unit tests and can confirm they are not broken. (If not possible, don't hesitate to ask for help!)
I made sure my commits build individually and have good descriptions as per KDE guidelines.
I made sure my code conforms to the standards set in the HACKING file.
I can confirm the code is licensed and attributed appropriately, and that unattributed code is mine, as per KDE Licensing Policy.