lua-users home
lua-l archive

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


Fabio Mascarenhas wrote:
Start from src/launcher/wsapi.fcgi in the WSAPI CVS and follow the
function calls to src/wsapi/common.lua.

And orbit.serve_static has to work with relative paths (looking in the
cwd, of course), what problems are you having?


I've described my problem in a response to Tomás Guisasola. I'll copy+paste it here in case the message didn't get through.

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