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

2012-05-30 Thread Artur Skawina
On 05/30/12 20:34, nrgyzer wrote: > 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);

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

2012-05-30 Thread bearophile
A better solution is to use: struct Path { enum : string { log1 = "/var/log1", log2 = "/var/log2" } } Or even just: struct Path { enum string log1 = "/var/log1", log2 = "/var/log2"; } (In D structs, classes and enums start with an upper case). Bye,

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 c

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 path

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