So, I've been developing some small applications in Lua, and one
issue
that's come to light is once my app is installed, if it's made up of
more than one script, the main 'executable' script needs to know
where
to find the other scripts.
It's enough to use os.getenv('PWD') .. arg[0] during testing, but
that
won't work if the script is in the $PATH. Unfortunately my
understanding is there's no standard way to determine the current
path
of the executable.
I'm also not sure what is the best practice when it comes to
installing a program that consists of several files (the main
executable and several sub-scripts it includes) on a Linux system.
With a compiled language you can split your source code into as many
files as you like and still produce a single compiled binary, but
with
Lua all those individual files *are* your "binary".
Should I just install the main script in the usual place
(/usr/local/bin or /usr/bin), the additional scripts in some other
standard place (/usr[/local]/share/appname/?), and have it try to
find
them in those standard places? Or is there a better way to handle
this?