Re: std.path.buildPath

2017-06-12 Thread Russel Winder via Digitalmars-d-learn
On Sun, 2017-06-04 at 21:32 +0200, Jacob Carlborg via Digitalmars-d- learn wrote: > On 2017-06-04 19:05, Patrick Schluter wrote: > > > buildPath("/usr/bin", "/usr/bin/gcc") > > > > /usr/bin/usr/bin/gcc is obviously wrong. > > Says who? It might be exactly what I want. The case that came up is

Re: std.path.buildPath

2017-06-12 Thread Russel Winder via Digitalmars-d-learn
On Sun, 2017-06-11 at 13:21 +, Ryan Frame via Digitalmars-d-learn wrote: > On Sunday, 4 June 2017 at 18:15:36 UTC, Russel Winder wrote: > > On Sun, 2017-06-04 at 17:56 +0200, Jacob Carlborg via > > Digitalmars-d- learn wrote: > > > On 2017-06-04 07:44, Jesse Phillips wrote: > > > > > > >

Re: std.path.buildPath

2017-06-11 Thread Ryan Frame via Digitalmars-d-learn
On Sunday, 4 June 2017 at 18:15:36 UTC, Russel Winder wrote: On Sun, 2017-06-04 at 17:56 +0200, Jacob Carlborg via Digitalmars-d- learn wrote: On 2017-06-04 07:44, Jesse Phillips wrote: > What is your expected behavior? Throw an exception? You can't > really > append an absolute path to

Re: std.path.buildPath

2017-06-04 Thread Jacob Carlborg via Digitalmars-d-learn
On 2017-06-04 19:05, Patrick Schluter wrote: buildPath("/usr/bin", "/usr/bin/gcc") /usr/bin/usr/bin/gcc is obviously wrong. Says who? It might be exactly what I want. The case that came up is inside DStep. The user provides a set of files C header to be translated to D modules. The user

Re: std.path.buildPath

2017-06-04 Thread Russel Winder via Digitalmars-d-learn
On Sun, 2017-06-04 at 17:56 +0200, Jacob Carlborg via Digitalmars-d- learn wrote: > On 2017-06-04 07:44, Jesse Phillips wrote: > > > What is your expected behavior? Throw an exception? You can't > > really > > append an absolute path to another. > > Of course you can. I expect buildPath("/foo",

Re: std.path.buildPath

2017-06-04 Thread Patrick Schluter via Digitalmars-d-learn
On Sunday, 4 June 2017 at 15:56:58 UTC, Jacob Carlborg wrote: On 2017-06-04 07:44, Jesse Phillips wrote: What is your expected behavior? Throw an exception? You can't really append an absolute path to another. Of course you can. I expect buildPath("/foo", "/bar") to result in "/foo/bar".

Re: std.path.buildPath

2017-06-04 Thread Jacob Carlborg via Digitalmars-d-learn
On 2017-06-04 07:44, Jesse Phillips wrote: What is your expected behavior? Throw an exception? You can't really append an absolute path to another. Of course you can. I expect buildPath("/foo", "/bar") to result in "/foo/bar". That's how Ruby behaves. -- /Jacob Carlborg

Re: std.path.buildPath

2017-06-03 Thread David Nadlinger via Digitalmars-d-learn
On Saturday, 3 June 2017 at 14:12:03 UTC, Russel Winder wrote: I have no idea what drugs the person who chose that last one to be correct semantics was on at the time, but it was some seriously bad stuff. Of all people, I certainly didn't expect you to stray so far from the tone appropriate

Re: std.path.buildPath

2017-06-03 Thread Jacob Carlborg via Digitalmars-d-learn
On 2017-06-03 16:12, Russel Winder via Digitalmars-d-learn wrote: From the manual page on std.path.buildPath: writeln(buildPath("foo", "bar", "baz")); // "foo/bar/baz" writeln(buildPath("/foo/", "bar/baz")); // "/foo/b

std.path.buildPath

2017-06-03 Thread Russel Winder via Digitalmars-d-learn
From the manual page on std.path.buildPath: writeln(buildPath("foo", "bar", "baz")); // "foo/bar/baz" writeln(buildPath("/foo/", "bar/baz")); // "/foo/bar/baz" writeln(buildPath("/foo", "/bar"

std.path.buildPath() and string enumeration

2012-05-30 Thread nrgyzer
Hi, I've the following enumeration: enum path : string { log1 = /var/log1, log2 = /var/log2 } Now... when I try to do the following: string subDirectory = example; string newPath = buildPath(path.log1, subDirectory); I get the following errors: Error: template std.path.buildPath does

Re: std.path.buildPath() and string enumeration

2012-05-30 Thread bearophile
nrgyzer: Is this a bug in std.path.buildPath() or is there anything I'm doing wrong? The signature of buildPath is: immutable(C)[] buildPath(C)(const(C[])[] paths...); But your inputs aren't of the same type. Named enum create their own type. You give buildPath a type string and a type

Re: std.path.buildPath() and string enumeration

2012-05-30 Thread nrgyzer
== Auszug aus bearophile (bearophileh...@lycos.com)'s Artikel nrgyzer: Is this a bug in std.path.buildPath() or is there anything I'm doing wrong? The signature of buildPath is: immutable(C)[] buildPath(C)(const(C[])[] paths...); But your inputs aren't of the same type. Named enum create

Re: std.path.buildPath() and string enumeration

2012-05-30 Thread Artur Skawina
the following errors: Error: template std.path.buildPath does not match any function template declaration Error: template std.path.buildPath(C) if (isSomeChar!(C)) cannot deduce template function from argument types !()(path,string) Error: template std.path.buildPath does not match any function template