It's just a macro that calls that when the code is parsed:

https://github.com/JuliaLang/julia/blob/2e3c72b64a9c669c18279639c1e7af3c8239908c/base/loading.jl#L117

This is different if its called from inside a function that is called at a
later point.

On Tue, Apr 21, 2015 at 8:59 AM, Michael Turok <[email protected]>
wrote:

> Hi Stefan,
>
> How is this different from Base.source_path()?
>
> Thanks,
> Michael
>
> On Tuesday, April 21, 2015 at 6:17:48 AM UTC-4, Stefan Karpinski wrote:
>>
>> There's a @__FILE__ macro that gives the path name of the current source
>> file, so if you want to load resources relative to that, you can do
>> joinpath(dirname(@__FILE__), "test", "data"). We might want to expose this
>> as @__DIR__ or something like that.
>>
>> On Mon, Apr 20, 2015 at 5:50 PM, Michael Francis <[email protected]>
>> wrote:
>>
>>> I'd like to load some local files from a module package directory. This
>>> is akin to the way java has resources. If this were julia code I could just
>>> include( 'foo.jl' ) and that will do mostly the right thing. Is there an
>>> equivalent without having to perform string math on Pkg.dir() ...
>>>
>>> I've seen the following in DataFrames - Is this the idiomatic way
>>>
>>> cd(Pkg.dir("DataFrames", "test", "data")) do ... and then perform file
>>> reads ?
>>>
>>> Thanks
>>>
>>>
>>

Reply via email to