Re: full path to source file __FILE__

2016-07-22 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, July 22, 2016 19:28:05 Jonathan Marler via Digitalmars-d-learn wrote: > Actually I realized if __FILE__ was always absolute, then all > your exception messages would contain the full path of the file > it was thrown from on the machine it was compiled on. This would > be quite odd. In

Re: Building phobos GDC

2016-07-22 Thread Lodovico Giaretta via Digitalmars-d-learn
On Friday, 22 July 2016 at 20:26:50 UTC, Rufus Smith wrote: On Friday, 22 July 2016 at 19:52:59 UTC, Lodovico Giaretta wrote: On Friday, 22 July 2016 at 18:30:13 UTC, Rufus Smith wrote: Trying to compile code that uses GDC, had to import phobos files from dmd in to project since they are not in

Re: Building phobos GDC

2016-07-22 Thread Rufus Smith via Digitalmars-d-learn
On Friday, 22 July 2016 at 19:52:59 UTC, Lodovico Giaretta wrote: On Friday, 22 July 2016 at 18:30:13 UTC, Rufus Smith wrote: Trying to compile code that uses GDC, had to import phobos files from dmd in to project since they are not in the GDC's phobo lib(the core.sys.windows stuff). Almost a

Re: Building phobos GDC

2016-07-22 Thread Lodovico Giaretta via Digitalmars-d-learn
On Friday, 22 July 2016 at 18:30:13 UTC, Rufus Smith wrote: Trying to compile code that uses GDC, had to import phobos files from dmd in to project since they are not in the GDC's phobo lib(the core.sys.windows stuff). Almost all the errors are related to stuff like PALETTEENTRY* peNew() retu

Re: Building phobos GDC

2016-07-22 Thread Lodovico Giaretta via Digitalmars-d-learn
On Friday, 22 July 2016 at 18:30:13 UTC, Rufus Smith wrote: Trying to compile code that uses GDC, had to import phobos files from dmd in to project since they are not in the GDC's phobo lib(the core.sys.windows stuff). Almost all the errors are related to stuff like PALETTEENTRY* peNew() retu

Re: full path to source file __FILE__

2016-07-22 Thread Jonathan Marler via Digitalmars-d-learn
On Friday, 22 July 2016 at 19:23:30 UTC, Steven Schveighoffer wrote: On 7/22/16 2:43 PM, Kagamin wrote: On Friday, 22 July 2016 at 13:50:55 UTC, Jonathan Marler wrote: shell/anypath> rdmd /somedir/clean.d Removing /somedir/build... So for command rdmd /somedir/clean.d what __FILE__ contains?

Re: full path to source file __FILE__

2016-07-22 Thread Jonathan Marler via Digitalmars-d-learn
On Friday, 22 July 2016 at 19:13:31 UTC, sdhdfhed wrote: On Friday, 22 July 2016 at 14:02:03 UTC, Jonathan Marler wrote: The __FILE__ trait seems to be used most useful for error messages. Another usage is for testing parsers or string functions directly on the source. E.g in "devel" mode the

Re: full path to source file __FILE__

2016-07-22 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/22/16 2:43 PM, Kagamin wrote: On Friday, 22 July 2016 at 13:50:55 UTC, Jonathan Marler wrote: shell/anypath> rdmd /somedir/clean.d Removing /somedir/build... So for command rdmd /somedir/clean.d what __FILE__ contains? LDC tells me the same path as specified on the command line, and that

Re: full path to source file __FILE__

2016-07-22 Thread sdhdfhed via Digitalmars-d-learn
On Friday, 22 July 2016 at 14:02:03 UTC, Jonathan Marler wrote: The __FILE__ trait seems to be used most useful for error messages. Another usage is for testing parsers or string functions directly on the source. E.g in "devel" mode the main function void main(string[] args) { version(de

Re: full path to source file __FILE__

2016-07-22 Thread Kagamin via Digitalmars-d-learn
On Friday, 22 July 2016 at 13:50:55 UTC, Jonathan Marler wrote: shell/anypath> rdmd /somedir/clean.d Removing /somedir/build... So for command rdmd /somedir/clean.d what __FILE__ contains? LDC tells me the same path as specified on the command line, and that is specified relative to current d

Building phobos GDC

2016-07-22 Thread Rufus Smith via Digitalmars-d-learn
Trying to compile code that uses GDC, had to import phobos files from dmd in to project since they are not in the GDC's phobo lib(the core.sys.windows stuff). Almost all the errors are related to stuff like PALETTEENTRY* peNew() return { return _peNew.ptr; } Does that even make sense?

Re: full path to source file __FILE__

2016-07-22 Thread Jonathan Marler via Digitalmars-d-learn
On Friday, 22 July 2016 at 09:37:24 UTC, sdhdfhed wrote: On Friday, 22 July 2016 at 08:36:37 UTC, Jonathan Marler wrote: On Friday, 22 July 2016 at 07:57:35 UTC, sdhdfhed wrote: On Friday, 22 July 2016 at 07:47:14 UTC, Jonathan Marler wrote: On Friday, 22 July 2016 at 05:41:00 UTC, fdgdsgf wro

Re: full path to source file __FILE__

2016-07-22 Thread Jonathan Marler via Digitalmars-d-learn
On Friday, 22 July 2016 at 13:30:10 UTC, Steven Schveighoffer wrote: On 7/22/16 3:47 AM, Jonathan Marler wrote: What's wrong with __FILE__.dirName ? It's kinda weird, sometimes I've noticed that the __FILE__ keyword is an absolute path, and sometimes it isn't. If you combine it with curren

Re: full path to source file __FILE__

2016-07-22 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/22/16 3:47 AM, Jonathan Marler wrote: What's wrong with __FILE__.dirName ? It's kinda weird, sometimes I've noticed that the __FILE__ keyword is an absolute path, and sometimes it isn't. If you combine it with current working directory, this should give you the full path. Looks like s

Re: full path to source file __FILE__

2016-07-22 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 22 July 2016 at 10:51:57 UTC, Kagamin wrote: Don't just ignore Adam's question :) eh he answered it. On Windows, it is somewhat common for things to be loaded or modified (especially on older versions when these were still writable...) from the program's directory. Its support fil

JSON Serialization with runtime filtering.

2016-07-22 Thread Alexander Milushev via Digitalmars-d-learn
I there any json serialization library which allow to make decision about ignoring fields in runtime? I trying to write rest client but server accept either 'cmd' or 'args' field for example and I need to find solution.

Re: full path to source file __FILE__

2016-07-22 Thread Kagamin via Digitalmars-d-learn
On Friday, 22 July 2016 at 07:53:17 UTC, Jonathan Marler wrote: It's important to remember that the clean.d script is ran with rdmd, and that it is meant to be called from any directory. Since it's ran with rdmd, the thisExePath won't give you the right directory, and since you can call it fro

Re: full path to source file __FILE__

2016-07-22 Thread sdhdfhed via Digitalmars-d-learn
On Friday, 22 July 2016 at 08:36:37 UTC, Jonathan Marler wrote: On Friday, 22 July 2016 at 07:57:35 UTC, sdhdfhed wrote: On Friday, 22 July 2016 at 07:47:14 UTC, Jonathan Marler wrote: On Friday, 22 July 2016 at 05:41:00 UTC, fdgdsgf wrote: What's wrong with __FILE__.dirName ? It's kinda wei

Re: union initalization

2016-07-22 Thread Johannes Pfau via Digitalmars-d-learn
Am Fri, 22 Jul 2016 01:48:52 + schrieb Rufus Smith : > I would like to combine two types > > > template Foo(A, B = 4) > { > union > { > byte b = B; > int a = A << 8; > } > } > > > I get an error about overlapping default initialization. They > don't actually

Re: full path to source file __FILE__

2016-07-22 Thread Jonathan Marler via Digitalmars-d-learn
On Friday, 22 July 2016 at 07:57:35 UTC, sdhdfhed wrote: On Friday, 22 July 2016 at 07:47:14 UTC, Jonathan Marler wrote: On Friday, 22 July 2016 at 05:41:00 UTC, fdgdsgf wrote: What's wrong with __FILE__.dirName ? It's kinda weird, sometimes I've noticed that the __FILE__ keyword is an absol

Re: full path to source file __FILE__

2016-07-22 Thread sdhdfhed via Digitalmars-d-learn
On Friday, 22 July 2016 at 07:57:35 UTC, sdhdfhed wrote: On Friday, 22 July 2016 at 07:47:14 UTC, Jonathan Marler wrote: [...] Personally I've never seen a relative __FILE__. Is this an issue that's confirmed ? I mean that it would be better to fix __FILE__ so that its result is always ab

Re: full path to source file __FILE__

2016-07-22 Thread sdhdfhed via Digitalmars-d-learn
On Friday, 22 July 2016 at 07:47:14 UTC, Jonathan Marler wrote: On Friday, 22 July 2016 at 05:41:00 UTC, fdgdsgf wrote: What's wrong with __FILE__.dirName ? It's kinda weird, sometimes I've noticed that the __FILE__ keyword is an absolute path, and sometimes it isn't. If it was always an ab

Re: full path to source file __FILE__

2016-07-22 Thread Jonathan Marler via Digitalmars-d-learn
On Friday, 22 July 2016 at 06:45:58 UTC, Jacob Carlborg wrote: On 2016-07-22 04:24, Jonathan Marler wrote: The script depends on other files relative to where it exists on the file system. I couldn't think of a better design to find these files then knowing where the script exists, can you?

Re: full path to source file __FILE__

2016-07-22 Thread Jonathan Marler via Digitalmars-d-learn
On Friday, 22 July 2016 at 05:41:00 UTC, fdgdsgf wrote: On Thursday, 21 July 2016 at 19:54:34 UTC, Jonathan Marler wrote: Is there a way to get the full path of the current source file? Something like: __FILE_FULL_PATH__ I'm asking because I'm rewriting a batch script in D, meant to be ran w