Re: loading lua scripts relative to an app's path
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: loading lua scripts relative to an app's path
- From: Nick Gammon <nick@...>
- Date: Sat, 7 Oct 2006 20:33:36 +1000
On 07/10/2006, at 7:51 PM, Wesley Smith wrote:
Is this available? I still haven't figured out how to do this as
argv[0] isn't entirely reliable.
Well, it depends on your application. Using argv [0] depends on the
application being launched as a "console" application.
In my case, the scripting is imbedded into a Windows GUI application,
and the OS provides GetModuleFileName, which is the full pathname of
the application that is currently running.
Another string might be the current directory, not necessarily the
path of the application. I use getcwd for that (actually _getcwd in
Windows).
Another string might be the path to the script, assuming the host
application launches a standalone script. In that case, presumably
the application knows the path to the script file, since it read it
in, in the first place. Again, this might be different than the above
two paths.
- Nick