Re: canonical or absolute path?
From: Jon A. Cruz (jon_at_joncruz.org)
Date: 01/23/04
- Next message: Anton Spaans: "Re: canonical or absolute path?"
- Previous message: Dale King: "Re: Proper (vs. desirable) use of Graphics object"
- In reply to: Steve W. Jackson: "Re: canonical or absolute path?"
- Next in thread: Anton Spaans: "Re: canonical or absolute path?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 23 Jan 2004 09:46:57 -0800
Steve W. Jackson wrote:
> In article <opr17w88ydcaoj5g@news.hsr.ch>,
> Richard Chrenko <richard.chrenko@solarenergy.ch> wrote:
>
>
>>:Although the Java SDK documentation defines "absolute" and "canonical"
>>:paths, the practical meaning is not clear to me. For example, if I want my
>>:application to save a list of "recent files", which should I use?
>
>
> I did some tinkering a few weeks ago with the two of them.
Yup. That's pretty much it.
Absolute allows you to access the file from any current position, since
it's a path from the top of the file system. Canonical is 'the' way to
write a path, and should always be the same.
http://foldoc.doc.ic.ac.uk/foldoc/foldoc.cgi?query=canonical
>
> If I'm correct in what I believe I understood, I would use canonical
> paths wherever possible.
Probably... but there is the gotcha that it can throw exceptions.
BTW, the javadoc for these methods have all those details.
http://java.sun.com/j2se/1.4.1/docs/api/java/io/File.html#getAbsolutePath()
http://java.sun.com/j2se/1.4.1/docs/api/java/io/File.html#getCanonicalPath()
There are a few more things specified (like when a canonical path can
change), so you should read the docs.
- Next message: Anton Spaans: "Re: canonical or absolute path?"
- Previous message: Dale King: "Re: Proper (vs. desirable) use of Graphics object"
- In reply to: Steve W. Jackson: "Re: canonical or absolute path?"
- Next in thread: Anton Spaans: "Re: canonical or absolute path?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]