Is there a simple way to take a given file path and modify it in order to avoid name collisions? Something like:
[StringUtils stringToAvoidNameCollisionForPath:path];
that for a given path of type: /foo/bar/file.png, will return /foo/bar/file-1.png and later it will increment that “-1” similarly to what Safari does for downloaded files.
UPDATE:
I followed Ash Furrow’s suggestion and I posted my implementation as answer 🙂
I decided to implement my own solution and I want to share my code. It’s not the most desirable implementation, but it seems to do the job:
… and the following are the tests I used: