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


Groups > comp.lang.java.programmer > #37366

Re: From java.nio.Path to Unix-style String on Windows

Newsgroups comp.lang.java.programmer
Date 2017-08-31 05:50 -0700
References <123f72bc-6240-488c-a007-0048d4468bee@googlegroups.com>
Message-ID <13c44e3a-dd90-47a7-adf5-264ca8074df5@googlegroups.com> (permalink)
Subject Re: From java.nio.Path to Unix-style String on Windows
From Eric Douglas <e.d.programmer@gmail.com>

Show all headers | View raw


On Thursday, August 31, 2017 at 5:48:36 AM UTC-4, Oliver Ruebenacker wrote:
> Hello,
> 
>   I have an app that generates command lines to be executed by Bash (the popular Unix shell). The command lines contain file names that are provided as java.nio.Path which are converted to String and then inserted.
> 
>   When run on Unix or like, a Path is converted to String Unix-style (e.g. /a/b/c), and that is just as Bash expects it.
> 
>   If run on Windows, however, a Path is converted to String Windows-style (e.g. C:a\b\c), and that fails, because Bash expects Unix-style file paths, even if it is run on Windows (e.g. Cygwin Bash, or Bash on Windows).
> 
>   How can I make sure a Path is always converted to String Unix-style, even if run on Windows?
> 
>   Thanks!
> 
>      Best, Oliver

What's the code look like, at what point exactly is it converting?

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

From java.nio.Path to Unix-style String on Windows Oliver Ruebenacker <curoli@gmail.com> - 2017-08-31 02:48 -0700
  Re: From java.nio.Path to Unix-style String on Windows Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-08-31 08:10 -0400
    Re: From java.nio.Path to Unix-style String on Windows Sebastian <nowhere@nirvana.org> - 2017-09-01 22:35 +0200
    Re: From java.nio.Path to Unix-style String on Windows Sebastian <nowhere@nirvana.org> - 2017-09-02 00:12 +0200
      Re: From java.nio.Path to Unix-style String on Windows Mike Amling <mamling@chaff.us> - 2017-09-02 22:05 -0500
  Re: From java.nio.Path to Unix-style String on Windows Eric Douglas <e.d.programmer@gmail.com> - 2017-08-31 05:50 -0700

csiph-web