"An error occurred, files can't be renamed"

Ideas for improvements and requests for new features in XnView MP

Moderators: XnTriq, xnview

Post Reply
Lofi
Posts: 8
Joined: Sun May 11, 2008 5:42 am

"An error occurred, files can't be renamed"

Post by Lofi » Thu Oct 24, 2013 4:56 am

During renaming I got the error "An error occurred, files can't be renamed". The message should state the specific error, not just "an error".

Reproduction:

* usage images IMG001, IMG002, IMG003, IMG004, IMG005
* swap IMG003 with IMG002 via drag/drop
* select images 001-004 (not the 5th)
* click rename (F2 key)
* double click on the 2nd(!) filename to create a template

Now the "start" field says it starts with 2, the images would be named IMG001 > IMG002, ..., IMG004 > IMG005. BUT IMG005 already exists (of course) => that's the error.

I'd recommend an initial check which ensures that the new image names don't exist. And during that check - should an image exist - show the name of that image.

User avatar
m.Th.
XnThusiast
Posts: 1575
Joined: Wed Aug 16, 2006 6:31 am
Contact:

Re: "An error occurred, files can't be renamed"

Post by m.Th. » Thu Oct 24, 2013 6:11 am

Already discussed. Also, I support this.

1. A more specific message is needed.

2. IMHO Such algorithms should be two-pass and NOT one-pass because it can lead to conflicts like the one described above.

Hence:

The algorithm should be:

- Get the file names in a list (this should be already accomplished because the program must display the file names in the GUI)
- Scan the list and rename each file to the result of a function like GetTempFileName. On Win there is an API for this, otherwise one can easily write such one by using a hash / random generator.
- Scan the list again and rename to the final file name.

IMHO the performance penalty should be negligible and certainly worth the effort in order to avoid confusions like this (IIRC the other user which posted a similar message some time ago did not find the real cause of the problem - ie. the name collision)
m. Th.

The Ascetic Experience - The best photos and texts from Holy Mountain (Athos)

- Dark Themed XnViewMP 0.90 64bit & XnView 2.00 x64 on Win7 x64 -

Post Reply