commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremias Maerki <dev.jerem...@greenmail.ch>
Subject [io] FilenameUtils needs work
Date Tue, 30 Dec 2003 13:50:15 GMT
As announced I'd like to outline how I currently see FilenameUtils.
Current problems are:
- Some test cases are disable because they fail.
- The test cases are incomplete. Some work only on Unix because they use
slashes and the Windows path separator is a backslash. Another example:
removeExtension looks for the last occurence of a dot which doesn't work
as soon as you forget to remove the path before the filename first.
- Some methods (like normalize) only work on Unix. They use hardcoded
slashes.
- Some methods are duplicates and still have to be removed.

I've started to work on that last week but have stopped as I realized
that we may need to discuss the approach first. FilenameUtils will be
expected to be written once and run everywhere. :-) So it has to work on
Unix and Windows (at least).

Sun with their java.io.File framework have special implementations of
the not quite public java.io.FileSystem class that seems to handle some
of the platform dependencies. Other things are handled within
java.io.File where backslashes get converted to slashes internally.

I think we should do that, too. But as in java.io.File there are a few
nasty things to consider (like UNC and drive-relative paths). I wonder
if we can handle all that properly without too much effort. I doubt so.

Another question is what to do with Windows-style filenames on Unix and
vice-versa. What should happen when a UNC path is processed on Unix? How
to write the test cases? A separate set for Windows and Unix? Should
FilenameUtil methods return Windows-style paths on a Unix machine if a
Windows-style path is used as input? If a mix is found (a mix of slashes
and backslashes) shall FilenameUtils return the platform-specific style?

As I stated before I'm not really a fan of working with String filenames
so I actually have a rather small motivation to work on this after I
found out about all the difficulties. I realize I'd rather skip
FilenameUtils for the initial release. If someone working on Unix is
really willing to help me (I'm working on Windows) work on FilenameUtils
then I'm in. But I'm sure it'll take some time until everything is
stable. If we target a release real soon now, I think we have to skip
FilenameUtils.

In this area we've had a related thread before (for those who want to
read that up):
http://nagoya.apache.org/eyebrowse/BrowseList?listName=commons-dev@jakarta.apache.org&by=thread&from=380749

That thread and the ideas there make this even more complicated. But we
don't have to do everything now I guess.

Thoughts?

Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message