XADMaster icon indicating copy to clipboard operation
XADMaster copied to clipboard

Smarter destination folder naming for duplicates

Open ci-macpaw opened this issue 15 years ago • 4 comments

Originally reported on Google Code with ID 184

rocionaveiras:

I expanded a file named auctex-11.85.tar.gz twice. The first time it was expanded into
a folder 
named auctex-11.85. The second time the destination folder name used was auctex-11-1.85.

Maybe it should be auctex-11.85-1?

ci-macpaw avatar Aug 18 '09 14:08 ci-macpaw

mac.marco.rotatori:

Maybe it's a stupid idea... if you put the number before the file name?
The example above should results like this:
auctex-11.85.tar.gz >>>
    auctex-11.85
    1-auctex-11.85
    2-auctex-11.85
    and so on...

ci-macpaw avatar Apr 13 '10 17:04 ci-macpaw

paracelsus:

Since LaunchServices is such a mess, it's probably hard to actually check just an extension.

But [NSFileManager isFilePackageAtPath:] might be able to do it, so that's one idea.
Either way, it'll have to wait 
until after 2.0. But that probably has its own problems, like what happens if somebody
makes a regular file with 
the same name as a bundle being unpacked...

ci-macpaw avatar Aug 20 '09 16:08 ci-macpaw

mokojumbie:

Could you not check to see whether the string after the last dot in a filename about
to be written to the filesystem is an extension belonging to a registered filetype?
Then, if it is not, append the incremented string to the end of the filename.
Otherwise, append it to the end of the sting preceding the last dot.

This would not fix the problem in cases where you are extracting a file for which an
appropriate handler is not installed, but I imagine it would be a little more elegant
than the current situation.

Amazing that nobody has proposed some kind of universally acceptable way to handle
this situation, as it's not unique to this software or even this platform, and the
challenges and considerations appear to be more-or-less the same. At least, I am
unaware of such a solution.

ci-macpaw avatar Aug 20 '09 15:08 ci-macpaw

paracelsus:

This is hard to get right. If it was named something.app, then the correct name is something-1.app,
not 
something.app-1. Same for any other kind of bundle. I don't know if there's a good
way to handle this.

I'll leave the issue here for now in case anyone can come up with a good solution for
how to generate names.

ci-macpaw avatar Aug 20 '09 01:08 ci-macpaw