lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

* 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.