Hi,

Have you decided if the proposed fix make since? If the corner case is
<DRIVE>:/, then it can be handled as well, not to remove the slash in case
the previous char is :.

Best Regards,
Dimitar

On Thu, Apr 21, 2016 at 7:12 PM, Leo Donahue <donahu...@gmail.com> wrote:

> On Apr 21, 2016 10:38 AM, "David kerber" <dcker...@verizon.net> wrote:
> >
> > On 4/21/2016 11:33 AM, Leo Donahue wrote:
> >>
> >> Chris,
> >>
> >> On Apr 21, 2016 9:15 AM, "Christopher Schultz" <
> ch...@christopherschultz.net>
> >> wrote:
> >>>
> >>>
> >>> I don't have a Windows machine handy right this minute, but from my
> >>> previous experience, "C:" means "the current working directory on the C
> >>> drive, from this process's perspective.
> >>>
> >>> For instance:
> >>>
> >>> D:\> DIR C:\
> >>> ...
> >>> Program Files
> >>> Windows
> >>> ...
> >>>
> >>> D:\> DIR C:
> >>> ...
> >>> Program Files
> >>> Windows
> >>> ...
> >>>
> >>> D:\> CD C:\Windows
> >>> D:\> DIR C:
> >>> ...
> >>> System
> >>> System32
> >>> ...
> >>>
> >>> So I would think that using "C:" (with no trailing path) from Java
> would
> >>> behave the same way: the current working directory *on that drive*
> would
> >>> be the one used.
> >>>
> >>> I would expect it to work just like "." on *NIX.
> >>>
> >>> -chris
> >>>
> >>> --------------------------------------------------------------
> >>
> >>
> >> On Windows 7 from a command prompt:
> >>
> >>> C:\downloads dir c:
> >>
> >> Shows contents of downloads
> >>
> >>> C:\downloads dir c:\
> >>
> >> Shows contents of c drive
> >
> >
> > Yes, that's all well-known on windows.  The question was, how does the
> Java File object handle it?   Does it give the correct result as above?
> And going back to the original question, how should these paths be
> normalized?
>
> Let's hope this looks right, pasting code from Android device...
>
> *import* java.io.File;
>
> *import* java.net.URI;
>
> *import* java.net.URISyntaxException;
>
> *import* java.util.ArrayList;
>
> *import* java.util.List;
>
>
>
> *public* *class* Demo
>
> {
>
>     *public* *static* *void* main(String[] args)
>
>     {
>
>         List<String> paths = *new* ArrayList<String>(2);
>
>         paths.add("file:/c:");
>
>         paths.add("file:/c:/");
>
>
>
>         *for* (String x : paths)
>
>         {
>
>             *try*
>
>             {
>
>                 URI uri = *new* URI(x);
>
>                 File f = *new* File(uri);
>
>                 System.*out*.println(f.getAbsolutePath());
>
>             }
>
>             *catch* (URISyntaxException e)
>
>             {
>
>                 e.printStackTrace();
>
>             }
>
>        }
>
>     }
>
> }
>

Reply via email to