Finding the path to a executable?

evilrat evilrat666 at gmail.com
Tue Aug 6 23:49:14 PDT 2013


On Wednesday, 7 August 2013 at 06:38:29 UTC, Kapps wrote:
> On Wednesday, 7 August 2013 at 06:22:25 UTC, evilrat wrote:
>> On Wednesday, 7 August 2013 at 06:18:26 UTC, Alan wrote:
>>> Believe me I have tried all sorts of combonations of this but 
>>> it's not guarunteed accuracy in certain situations, I thought 
>>> there would be a solution in phobos library I was missing but 
>>> maybe I will have to write something complex out.
>>> Thanks for all the help so far!
>>
>> putting all together try this(not tested)
>>
>> import std.path;
>>
>> void main(string[] args)
>> {
>> writeln(absolutePath(buildNormalizedPath(args[0])));
>> }
>
> I'd imagine (but I could be mistaken here) that that uses the 
> current working directory as the base. I've had issues with 
> this in the old std.path where the CWD is different from the 
> program when starting it up (possibly related to shortcuts, or 
> perhaps just the IDE setting it manually).

yes it probably may return wrong path when messed up with setcwd, 
but when taken at startup this in theory should always return 
actual program path.


More information about the Digitalmars-d mailing list