digitalmars.D.learn - thisExePath and rdmd
- Andrea Fontana (5/5) Jan 17 2014 thisExePath "returns the full path of the current executable".
- Jacob Carlborg (6/10) Jan 17 2014 That doesn't sound very easy to fix. When running the executable it's
- Andrea Fontana (5/16) Jan 17 2014 Hmm I thought It can be done reading __FILE__ at compile-time,
- Jacob Carlborg (4/6) Jan 17 2014 Right, forgot about __FILE__.
- Andrea Fontana (3/8) Jan 17 2014 I think it would be useful to put full path on __FILE__ or to add
- Jacob Carlborg (4/6) Jan 17 2014 I agree. Probably safest to add a new constant, to avoid breaking code.
thisExePath "returns the full path of the current executable". If I run something like "./mysource.d" (using rdmd shebang) it returns the full path to compiled executable in /tmp folder (not so useful I think!). Is there a way to have the path of source itself?
Jan 17 2014
On 2014-01-17 10:23, Andrea Fontana wrote:thisExePath "returns the full path of the current executable". If I run something like "./mysource.d" (using rdmd shebang) it returns the full path to compiled executable in /tmp folder (not so useful I think!). Is there a way to have the path of source itself?That doesn't sound very easy to fix. When running the executable it's completely disconnected from the source file it was compiled from. Except for possibly some debug info. -- /Jacob Carlborg
Jan 17 2014
Hmm I thought It can be done reading __FILE__ at compile-time, but it gives me just the relative path. Recent topic here: http://forum.dlang.org/thread/meuyppazxkrjcbgmkonl forum.dlang.org On Friday, 17 January 2014 at 09:29:48 UTC, Jacob Carlborg wrote:On 2014-01-17 10:23, Andrea Fontana wrote:thisExePath "returns the full path of the current executable". If I run something like "./mysource.d" (using rdmd shebang) it returns the full path to compiled executable in /tmp folder (not so useful I think!). Is there a way to have the path of source itself?That doesn't sound very easy to fix. When running the executable it's completely disconnected from the source file it was compiled from. Except for possibly some debug info.
Jan 17 2014
On 2014-01-17 10:50, Andrea Fontana wrote:Hmm I thought It can be done reading __FILE__ at compile-time, but it gives me just the relative path.Right, forgot about __FILE__. -- /Jacob Carlborg
Jan 17 2014
On Friday, 17 January 2014 at 10:48:33 UTC, Jacob Carlborg wrote:On 2014-01-17 10:50, Andrea Fontana wrote:I think it would be useful to put full path on __FILE__ or to add another constant. Anyone?Hmm I thought It can be done reading __FILE__ at compile-time, but it gives me just the relative path.Right, forgot about __FILE__.
Jan 17 2014
On 2014-01-17 15:29, Andrea Fontana wrote:I think it would be useful to put full path on __FILE__ or to add another constant. Anyone?I agree. Probably safest to add a new constant, to avoid breaking code. -- /Jacob Carlborg
Jan 17 2014