Get file path of script being executed

U

Ubaldo Villaseca

Hi all,
I have some directories in my project like:
+ communications
+ model
+ database
+ database/sqlite
+ http

Every directory contains scripts, more specifically classes, that are
called from a main script Portal.rb located in the base directory. How
could those scripts get in its own code its complete path? I try some
solutions from Internet but I just get the path to Portal.rb

Thanks,
Ubaldo
 
X

Xavier Noria

Hi all,
I have some directories in my project like:
+ communications
+ model
+ database
+ database/sqlite
+ http

Every directory contains scripts, more specifically classes, that are
called from a main script Portal.rb located in the base directory. How
could those scripts get in its own code its complete path? I try some
solutions from Internet but I just get the path to Portal.rb

Check the __FILE__ variable in each one.

-- fxn
 
L

linkin_t

Note: parts of this message were removed by the gateway to make it a legal Usenet post.

actual_folder = File.basedir(__FILE__.gsub(/\\/, '/')

Or something like this...
 

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
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top