Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #29803 > unrolled thread

A "current directory" concept for Java...

Started byAndreas Leitgeb <avl@auth.logic.tuwien.ac.at>
First post2014-08-22 16:49 +0000
Last post2014-08-23 05:31 -0700
Articles 2 on this page of 22 — 5 participants

Back to article view | Back to comp.lang.java.programmer


Contents

  A "current directory" concept for Java... Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-08-22 16:49 +0000
    Re: A "current directory" concept for Java... Jeff Higgins <jeff@invalid.invalid> - 2014-08-22 14:50 -0400
    Re: A "current directory" concept for Java... Jeff Higgins <jeff@invalid.invalid> - 2014-08-22 15:10 -0400
    Re: A "current directory" concept for Java... Martin Gregorie <martin@address-in-sig.invalid> - 2014-08-22 19:26 +0000
      Re: A "current directory" concept for Java... Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-08-22 23:38 +0000
        Re: A "current directory" concept for Java... Martin Gregorie <martin@address-in-sig.invalid> - 2014-08-23 14:24 +0000
          Re: A "current directory" concept for Java... Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-08-23 16:31 +0000
            Re: A "current directory" concept for Java... Martin Gregorie <martin@address-in-sig.invalid> - 2014-08-23 19:34 +0000
              Re: A "current directory" concept for Java... Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-08-24 08:42 +0000
                Re: A "current directory" concept for Java... Martin Gregorie <martin@address-in-sig.invalid> - 2014-08-24 10:37 +0000
                  Re: A "current directory" concept for Java... Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-08-24 13:41 +0000
                    Re: A "current directory" concept for Java... Martin Gregorie <martin@address-in-sig.invalid> - 2014-08-24 18:33 +0000
                      Re: A "current directory" concept for Java... Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-08-24 22:33 +0000
                        Re: A "current directory" concept for Java... Martin Gregorie <martin@address-in-sig.invalid> - 2014-08-25 00:14 +0000
    Re: A "current directory" concept for Java... Jeff Higgins <jeff@invalid.invalid> - 2014-08-22 19:45 -0400
      Re: A "current directory" concept for Java... Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-08-23 15:32 +0000
        Re: A "current directory" concept for Java... Jeff Higgins <jeff@invalid.invalid> - 2014-08-23 12:49 -0400
        Re: A "current directory" concept for Java... Jeff Higgins <jeff@invalid.invalid> - 2014-08-23 17:40 -0400
    Re: A "current directory" concept for Java... Jan Burse <janburse@fastmail.fm> - 2014-08-23 10:31 +0200
      With new Path (Re: A "current directory" concept for Java...) Jan Burse <janburse@fastmail.fm> - 2014-08-23 10:48 +0200
        Re: With new Path (Re: A "current directory" concept for Java...) Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-08-23 14:38 +0000
    Re: A "current directory" concept for Java... Roedy Green <see_website@mindprod.com.invalid> - 2014-08-23 05:31 -0700

Page 2 of 2 — ← Prev page 1 [2]


#29822 — Re: With new Path (Re: A "current directory" concept for Java...)

FromAndreas Leitgeb <avl@auth.logic.tuwien.ac.at>
Date2014-08-23 14:38 +0000
SubjectRe: With new Path (Re: A "current directory" concept for Java...)
Message-ID<slrnlvh9qe.fp3.avl@login.logic.tuwien.ac.at>
In reply to#29817
Jan Burse <janburse@fastmail.fm> wrote:
> Jan Burse schrieb:
>> The getCanonicalPath() method will usually resolve
>> ../ and ./ parts in the str together with curdir.
> Things are a little confusing under the hood of
> java.io.File. Since they use a method named resolve
> which does not resolve ../ and ./.
> The same confusion is under the hood of java.nio.file.Path,
> the method named resolve does also not resolve ../ and
> ./. Here you have to use the method normalize.
> So the solution with path would be:
> public class State {
>      private static String curdir;
>      public void chDir(String str) {
>          curdir = Paths.getPath(curdir).resolve(str).normalize();
>      }
> }

Yes, I've already meanwhile found (and posted about) Path.resolve().

The wrapper for *that* is now obviously trivial. 

Thanks, anyway!

[toc] | [prev] | [next] | [standalone]


#29820

FromRoedy Green <see_website@mindprod.com.invalid>
Date2014-08-23 05:31 -0700
Message-ID<o72hv9tic2m2vogdo48lc3oufrgup871rd@4ax.com>
In reply to#29803
On Fri, 22 Aug 2014 16:49:12 +0000 (UTC), Andreas Leitgeb
<avl@auth.logic.tuwien.ac.at> wrote, quoted or indirectly quoted
someone who said :

>roll my own.

If you had File object with the current dir in it, and plopped your
relative filenames in for the file part, possibly multilegged,
possibly with leading dots, is it clever enough to treat the File
Object as a current directory? or do you truly have to roll your own?
-- 
Roedy Green Canadian Mind Products http://mindprod.com
Errors using inadequate data are much less than those using no data at all. 
~ Charles Babbage (born: 1791-12-26 died: 1871-10-18 at age: 79)

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

Back to top | Article view | comp.lang.java.programmer


csiph-web