[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: ./?.lua in the default search path
- From: Florian Weimer <fw@...>
- Date: Sat, 30 May 2009 21:31:24 +0200
* Matthew Wild:
>> - Instead of ".", use the path of the current script. (This is what
>> Python does.) It seems that this is already implemented for
>> Windows, but I'm not sure about that.
> I would much prefer this solution, but I'm not sure how (or if) it
> can be done in a portable fashion.
On Unix-like systems, the script interpreter is passed the path to the
script. You could call realpath() on the name and chop it at the last
slash. realpath() is probably not universally available, but it's not
that different from GetModuleFileNameA in this regard.