Erlang/OTP Forums

Author Message

<  Erlang  ~  How to get folder of the current module?

jacek99
Posted: Tue May 26, 2009 6:25 pm Reply with quote
User Joined: 26 May 2009 Posts: 27 Location: Montreal, Canada
I know I get get the current module name using ?MODULE...but how do I get the current folder in which the module .erl file is located?

thanks
View user's profile Send private message
seanmc
Posted: Wed May 27, 2009 7:27 am Reply with quote
User Joined: 03 Aug 2007 Posts: 10
Hi Jacek,

?MODULE:module_info() might be able to help you.
You can match out the compile, source element:

mod:module_info().
[{exports,[{init,0},
{cmds,0},
{stop,0},
{start,0}]},
{imports,[]},
{attributes,[{vsn,[277449438541699252019369955108873496019]}]},
{compile,[{options,[export_all,export_all]},
{version,"4.6"},
{time,{2009,5,26,13,3,34}},
{source,"/home/user/mod.erl"}]}]


//Sean.
View user's profile Send private message
jacek99
Posted: Tue Jun 02, 2009 2:03 pm Reply with quote
User Joined: 26 May 2009 Posts: 27 Location: Montreal, Canada
Thanks Sean, was a good reason to do some pattern matching Very Happy
View user's profile Send private message

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum