← Back to team overview

registry team mailing list archive

[Bug 648424] Re: Export doesn't deal with different files with same filename

 

I think there's any number of ways we can go about doing this.
Michael's ideas are great, but they involve a broader idea of exporting
photos -- being able to customize names and ordering and numbering,
almost like generating a report.  That's a scheme far larger than this
ticket.

The problem here is when you export two photos with the same filename,
the second one clobbers the first.  That's obviously not right.  What if
we did something super-simple: When going to export the file, if the
filename exists, append an underscore and a numeral and see if that file
exists.  If so, keep appending numbers until one is found.

With this scheme you would get files like this:

IMG_0123.JPG
IMG_0123_1.JPG

Not as powerful as Michael's idea, but it will work, and preserves the
original filename (which is sometimes human-readable).

As it turns out, we have code in Shotwell that does exactly this (we use
it for import).  In file_util.vala is a function generate_unique_file().
The function returns a File object with a unique name (using the
original if possible).

This, I think, is the easiest way to go to solve this ticket.  Michael,
I think your ideas are interesting, as always.  If you'd like to propose
a new feature, I encourage you to file a ticket fleshing this out on our
Trac server: http://trac.yorba.org.

-- Jim

-- 
Export doesn't deal with different files with same filename
https://bugs.launchpad.net/bugs/648424
You received this bug notification because you are a member of Registry
Administrators, which is the registrant for Shotwell.



Follow ups