Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #37376
| Path | csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Mike Amling <mamling@chaff.us> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: From java.nio.Path to Unix-style String on Windows |
| Date | Sat, 2 Sep 2017 22:05:45 -0500 |
| Organization | A noiseless patient Spider |
| Lines | 32 |
| Message-ID | <oofr89$c24$1@dont-email.me> (permalink) |
| References | <123f72bc-6240-488c-a007-0048d4468bee@googlegroups.com> <oo8u3e$3is$1@dont-email.me> <oocm0n$ra5$1@news.albasani.net> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8; format=flowed |
| Content-Transfer-Encoding | 8bit |
| Injection-Date | Sun, 3 Sep 2017 03:00:25 -0000 (UTC) |
| Injection-Info | mx02.eternal-september.org; posting-host="9ac1762abf408975646fa9f3b274ee19"; logging-data="12356"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/zcYCb7L7BBJsBA+jDF594" |
| User-Agent | Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 |
| In-Reply-To | <oocm0n$ra5$1@news.albasani.net> |
| Content-Language | en-US |
| Cancel-Lock | sha1:47oElW1nHxOfqzz0vkpgqW1WYm0= |
| Xref | csiph.com comp.lang.java.programmer:37376 |
Show key headers only | View raw
On 9/1/17 5:12 PM, Sebastian wrote: > Am 31.08.2017 um 14:10 schrieb Eric Sosman: >> On 8/31/2017 5:48 AM, 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). >>> > > > I don't get the part about stripping away the drive letters. Paths like > C:/blabla/... are perfectly acceptable to my bash (GitBash on Windows). My dim recollection is that the Cygwin-supplied utilities that take file names on the command line (e.g. ls, cat, diff, ...) understand the drive letter just fine but backslashes need to be converted to slashes. --Mike Amling QnV0IHRoZSBub24tQ3lnd2luIHByb2dyYW1zLCBlLmcuIGphdmEuZXhlLCBkb24ndCByZWNvZ25p emVkIC9jeWdkcml2ZS9jL2RpcmVjdG9yeS9maWxlIGV2ZW4gd2hlbiBpbnZva2VkIGJ5IEJhc2gg YW5kIG5lZWQgQzovZGlyZWN0b3J5L2ZpbGUgb3IgQzpcZGlyZWN0b3J5XGZpbGUu
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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