Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
when $0 isn't what I want
Chad Perrin
9/20/2007 8:53:00 PM
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.
--
CCD CopyWrite Chad Perrin [
http://ccd.ap...
]
Larry Wall: "A script is what you give the actors. A program is what you
give the audience."
2 Answers
Phlip
9/20/2007 9:06:00 PM
0
> When using eruby for web development, $0 for any given .rhtml file
File.dirname(__FILE__)
Variations with Pathname are much more programmer-friendly, too!
--
Phlip
Chad Perrin
9/20/2007 9:24:00 PM
0
On Fri, Sep 21, 2007 at 06:06:04AM +0900, Phlip wrote:
> > When using eruby for web development, $0 for any given .rhtml file
>
> File.dirname(__FILE__)
I coulda sworn I'd tried that already. Apparently not.
Thanks!
--
CCD CopyWrite Chad Perrin [
http://ccd.ap...
]
Larry Wall: "A script is what you give the actors. A program is what you
give the audience."
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
when $0 isn't what I want
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password