How to compile and link simple application?
Julian
julian.fondren at gmail.com
Mon Apr 8 19:05:33 UTC 2019
On Monday, 8 April 2019 at 18:54:10 UTC, Julian wrote:
> @property
> string root_dir() {
> static string cache;
> static bool isInit = false;
> if (!isInit) {
> isInit = true;
> cache = dirName(thisExePath());
> }
> return cache;
> }
Shorter:
string root_dir() {
static string cache;
return cache ? cache : (cache = dirName(thisExePath()));
}
This might spam readlink() syscalls if they somehow return the
empty string,
but how would that even happen...
More information about the Digitalmars-d-learn
mailing list