[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

File path

Advait Bellur

12/26/2007 1:01:00 PM

Hi,

I needed to know how to find the path of a file at a particulat
place so that it should effect all the places where its called.

I am hard coding it presently, is there a means of writing this
path some where and then calling it where ever needed

file = File.open("/home/Ruby_Files/add.rb","r")

Thanking You

ARB
--
Posted via http://www.ruby-....

2 Answers

Robert Klemme

12/27/2007 12:55:00 PM

0

2007/12/26, Advait Bellur <advait.bellur@yahoo.co.in>:
> Hi,
>
> I needed to know how to find the path of a file at a particulat
> place so that it should effect all the places where its called.
>
> I am hard coding it presently, is there a means of writing this
> path some where and then calling it where ever needed
>
> file = File.open("/home/Ruby_Files/add.rb","r")

The usual solution is to put the path into a variable or constant and
use that instead of literals.

Cheers

robert

--
use.inject do |as, often| as.you_can - without end

Advait Bellur

12/27/2007 1:11:00 PM

0

Robert Klemme wrote:
> 2007/12/26, Advait Bellur <advait.bellur@yahoo.co.in>:
>> Hi,
>>
>> I needed to know how to find the path of a file at a particulat
>> place so that it should effect all the places where its called.
>>
>> I am hard coding it presently, is there a means of writing this
>> path some where and then calling it where ever needed
>>
>> file = File.open("/home/Ruby_Files/add.rb","r")
>
> The usual solution is to put the path into a variable or constant and
> use that instead of literals.
>
> Cheers
>
> robert



Hi,

Thank you very much the method of assigning to a variable and then using
the variable is working perfectly.

Thank you

Advait
--
Posted via http://www.ruby-....