Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 63706 invoked from network); 22 Nov 2004 01:25:33 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 22 Nov 2004 01:25:33 -0000 Received: (qmail 56322 invoked by uid 500); 22 Nov 2004 01:25:31 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 56030 invoked by uid 500); 22 Nov 2004 01:25:30 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 56015 invoked by uid 99); 22 Nov 2004 01:25:30 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=RCVD_BY_IP,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: domain of mfncooper@gmail.com designates 64.233.184.203 as permitted sender) Received: from [64.233.184.203] (HELO wproxy.gmail.com) (64.233.184.203) by apache.org (qpsmtpd/0.28) with ESMTP; Sun, 21 Nov 2004 17:25:27 -0800 Received: by wproxy.gmail.com with SMTP id 55so180948wri for ; Sun, 21 Nov 2004 17:25:23 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=nnDT1P5fum1NhpXHdt0nKH3TWr17kxiEI6IRTeFYKaeFos9Zz7b/PW7vmG5VJzXz2fCOu6YWggXDiYsFNMlQONKDkD4igg8dDZABWBmEYssJ1wkYpQ3axIhaL4BAZ93GKlYxIWrIL7zpRoQ1To4XRgDK7I1hiYWmtcRsqQcuLfU= Received: by 10.54.29.38 with SMTP id c38mr1471710wrc; Sun, 21 Nov 2004 17:25:23 -0800 (PST) Received: by 10.54.7.56 with HTTP; Sun, 21 Nov 2004 17:25:23 -0800 (PST) Message-ID: <16d6c620041121172535519030@mail.gmail.com> Date: Sun, 21 Nov 2004 17:25:23 -0800 From: Martin Cooper Reply-To: Martin Cooper To: Jakarta Commons Developers List Subject: Re: [io] Filename prefixes In-Reply-To: <004a01c4d031$10f9d580$cf752bd9@oemcomputer> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <004401c4d02f$13e60ae0$cf752bd9@oemcomputer> <16d6c62004112117105506c973@mail.gmail.com> <004a01c4d031$10f9d580$cf752bd9@oemcomputer> X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N On Mon, 22 Nov 2004 01:17:40 -0000, Stephen Colebourne wrote: > Basically it looks like we'll need: > > getPrefix() - C:\ > getPath() - dev\project > getFullPath() - C:\dev\project > getName() - file.txt > getExtension() - txt > (input C:\dev\project\file.txt) Perhaps one more: getBaseName() - file > Normalize/catPath can then use the other methods to stitch together a > result. > > Naming: > catPath() should be renamed to concat() That's fine. I think your earlier suggestion was merge(), but I like concat() better. ;-) > getFullPath()/getPath() - are these logical names? I think getFullPath() is fine. I'm not so thrilled with getPath(), since I suspect people might expect it to do what getFullPath() does, but I don't have any good suggestions for an alternative name. I'm fine with the use of the term 'prefix', since I've seen it used elsewhere with the same meaning. -- Martin Cooper > > Stephen > > > > ----- Original Message ----- > From: "Martin Cooper" > > On Mon, 22 Nov 2004 01:03:28 -0000, Stephen Colebourne > > wrote: > > > In order to write the normalize() method properly, I realised that we > have > > > to deal with filename prefixes properly. The point being that you can't > .. > > > up into a filename prefix. > > > > > > Here's the javadoc for the method I'm writing. Does this cover the > cases? > > > > Looks good to me. I can't think of any other options, at least for > > Windows and Unix. > > > > -- > > Martin Cooper > > > > > > > > > > /** > > > * Returns the length of the filename prefix, such as > C:/ > > > or ~/. > > > *

> > > * This method will handle a file in either Unix or Windows format. > > > * The prefix includes the first slash in the full filename. > > > *

> > >     * Windows:
> > >     * a\b\c.txt           --> ""          --> relative
> > >     * \a\b\c.txt          --> "\"         --> drive relative
> > >     * C:\a\b\c.txt        --> "C:\"       --> absolute
> > >     * \\server\a\b\c.txt  --> "\\server\" --> UNC
> > >     *
> > >     * Unix:
> > >     * a/b/c.txt           --> ""          --> relative
> > >     * /a/b/c.txt          --> "/"         --> absolute
> > >     * ~/a/b/c.txt         --> "~/"        --> current user relative
> > >     * ~user/a/b/c.txt     --> "~user/"    --> named user relative
> > >     * 
> > > * > > > * @param filename the filename to find the prefix in, null > returns -1 > > > * @return the length of the prefix, -1 if invalid or null > > > */ > > > > > > Stephen > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org > > > For additional commands, e-mail: commons-dev-help@jakarta.apache.org > > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org > > For additional commands, e-mail: commons-dev-help@jakarta.apache.org > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org > For additional commands, e-mail: commons-dev-help@jakarta.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org