Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#58 Rename dialogue: detects file name extensions wrongly

Incorrect_behaviour
open
nobody
ROX-Filer (85)
5
2005-03-12
2005-03-12
No

The rename dialogue marks the file name, excluding the
extension. But if a file name has more than one dot
'.', the first will be considered the delimiter instead
of the last. It would be better if the extension was
defined as the part of the name behind tha LAST
occurance of '.'.

Using 2.20 (2005-01-29) compiled from source. Running
on Debian 3.1 (sarge).

Kind regards

Andreas

Discussion

  • Stephen Watson
    Stephen Watson
    2005-03-12

    Logged In: YES
    user_id=471223

    This has been raised before on the mailing list. The
    problem is that some extensions do contain dots (tar.gz) and
    others don't. What should it do for ROX-Clib-2.1.4.tar.gz
    for example?

     
  • Logged In: YES
    user_id=122328

    @kerofin:

    There are 2 ways to solve this:

    1) In the case of tar.gz, tar.bz2 and the like you could
    argue that .gz or .bz2 is the extension of the "outer" file.
    Once it is unzipped .tar becomes the extension.

    2) If this is not possible for all extensions of that
    pattern (i.e. .<ext1>.<ext2>), maybe it is a better solution
    to have a (presumably relatively short) list of such endings
    to parse in case of file names.

    In any case the dots in the name string should be considered
    from right to left, not from left to right.

    Kind regards

    Andreas

    PS: I guess this might be interesting for more programs than
    just ROX Filer. Maybe it should become a standard at
    freedesktop.org how such file names should be handled ...

     
  • Thomas Leonard
    Thomas Leonard
    2005-05-29

    Logged In: YES
    user_id=40461

    If you rename "Archive.tar.gz", you probably don't want to
    change only the name and the first part of the extension.
    What kind of files are you trying to rename?

     
  • Logged In: YES
    user_id=122328

    Hi Tal197.

    Well, some of the files are indeed archive files with an
    extension of .tar.whatever. But most files are actually
    saved articles with very verbose file names -- along the
    lines of "2004-12-22_Mord_am_4._Advent.pdf" (where 4. is the
    German version of 4th) or
    "2005-01-20_3.47_billion_cigarettes_confiscated.pdf" and
    similar stuff. An algorithm handling this should perhaps

    1st: check for known extensions (from right to left).
    Recursively, to catch the likes of .tar.gz.

    2nd: If that doesn't help, assume that the extension is the
    part of the name from the end of the string to the first
    occurance of '.'. Maybe considering a maximum length of that
    "extension" so that in
    "mymachine-backup-script-0.5.1-buggy-output-2005-03-04" the
    part after the last dot is not considered an extension.

    3rd: Special handling of numbers might be necessary as in
    "bigfile.<ext>.1", where the actual extension would be the
    <ext> part, not the .1

    Kind regards

    Andreas