File path

A

Advait Bellur

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
 
R

Robert Klemme

2007/12/26 said:
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
 
A

Advait Bellur

Robert said:
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
 

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,274
Messages
2,571,367
Members
48,060
Latest member
JerrodSimc

Latest Threads

Top