when $0 isn't what I want

C

Chad Perrin

When using eruby for web development, $0 for any given .rhtml file is
always 'eruby'. This also means that any time I want to use a path
relative to the location of the .rhtml file being accessed, I'm out of
luck: paths are relative to the eruby executable instead.

How would I go about using relative paths from a current working path of
the .rhtml file, rather than from the eruby executable? I'd prefer a
more "portable" design for the code in the pages I'm putting together,
rather than having to use absolute paths that may lose their accuracy if
the web pages in question ever need to be moved to another server.
 
P

Phlip

When using eruby for web development, $0 for any given .rhtml file

File.dirname(__FILE__)

Variations with Pathname are much more programmer-friendly, too!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,264
Messages
2,571,323
Members
48,007
Latest member
Elvis60357

Latest Threads

Top