lua-users home
lua-l archive

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


Tomas Guisasola Gorham wrote:
	Hi Ignacio

I'd like the module to be aware of where it was picked up from. That's because I want my module to be able to construct full pathnames pointing to files in subdirectories.
	Why don't you use relative pathnames?

I can't. That's exactly what I'm trying to avoid. Maybe some info about what I'm trying to do is needed.

I'm doing some web stuff based upon Xavante, CgiLua and Orbit. From Xavante, I stripped the Copas' based server and replaced it with a multithreaded one written in C. I have a pool of luaStates, so when serving a request, I pick a state and pass control to it. From that point on, it behaves like Xavante, parsing the request, picking the right handler, etc.

I need to move away from relative paths because I can have two scripts running at the same time, each of them in different physical directories. I had to tweak CGILua to avoid changing directories and running each script with a full path.

This is working fine, I just prepend cgilua.script_pdir to the file I want to run. My problem is with Orbit. It relies on the process' current directory being the one in which the "orbit-enabled" app is located.

I'd like to avoid PA's suggestion about using debug.getinfo, since I might need to remove it, to disallow scripts fiddling with it. And I also would like to decrease the amount of 'path configuration' needed. I just want to say where a module is to be required, then I want the module itself to figure where are its resources.

Regards,
Ignacio Burgueño