Hello.
I'm rather new to Ruby, so please bare with me. I just want to know if there is anything similar to __FILE__ but which represents either the path to the directory which __FILE__ lies in, or the __FILE__ including the full path to the file?
I just want to know if there is anything similar to __FILE__ but which represents either the path to the directory which __FILE__ lies in, or the __FILE__ including the full path to the file?
Le vendredi 02 mars 2007 14:55, Deniz Dogan a écrit :
Hello.
I'm rather new to Ruby, so please bare with me. I just want to know if
there is anything similar to __FILE__ but which represents either the
path to the directory which __FILE__ lies in, or the __FILE__ including
the full path to the file?
You should be able to get all that information by combining it with __FILE__:
path = Pathname.new(__FILE__)
p path.dirname
p path.expand_path
# ...
···
On 3/2/07, Deniz Dogan <kristnjov@nospam.com> wrote:
Hello.
I'm rather new to Ruby, so please bare with me. I just want to know if
there is anything similar to __FILE__ but which represents either the
path to the directory which __FILE__ lies in, or the __FILE__ including
the full path to the file?
I suggested the same a while back as __DIR__. I too think it would be
a good thing to have.
T.
···
On Mar 2, 8:55 am, Deniz Dogan <kristn...@nospam.com> wrote:
Hello.
I'm rather new to Ruby, so please bare with me. I just want to know if
there is anything similar to __FILE__ but which represents either the
path to the directory which __FILE__ lies in, or the __FILE__ including
the full path to the file?
Le vendredi 02 mars 2007 14:55, Deniz Dogan a écrit :
Hello.
I'm rather new to Ruby, so please bare with me. I just want to know if
there is anything similar to __FILE__ but which represents either the
path to the directory which __FILE__ lies in, or the __FILE__ including
the full path to the file?
On Sat, Mar 03, 2007 at 12:15:31AM +0900, George Ogata wrote:
On 3/3/07, Daniel DeLorme <dan-ml@dan42.com> wrote:
>Olivier Renaud wrote:
>> You have to use the File.expand_path to do this :
>>
>> File.expand_path(__FILE__)
>> File.dirname(File.expand_path(__FILE__))
>
>Or:
>File.expand_path(__FILE__+'/..')
>
>;-)
>
>Daniel
Or even:
File.expand_path('..', __FILE__)
--
CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ]
Amazon.com interview candidate: "When C++ is your
hammer, everything starts to look like your thumb."