Yep. This is what I was hoping for too. However, just to be clear I would
want include("test0.jl") to work when the directory which contains test0.jl
is in LOAD_PATH.
Cheers,
Ethan
On Tuesday, March 11, 2014 7:43:47 AM UTC-7, J Luis wrote:
>
>
>
> Do you mean, all you want is "addpath(dirname) = push!(LOAD_PATH,
>> dirname)"?
>>
>
> By itself it would be already useful (imagine when one do not know this
> solution and have to search the docs for it)
>
>
>> Or something different?
>>
>
> Precisely. What I was referring was a way to declare paths that would be
> searched by the 'include' and not having errors like this (when the
> test0.jl file exists in LOAD_PATH). And not having to play around with the
> 'require()'
>
> julia> include("test0.jl")
> ERROR: could not open file C:\programs\julia64\test0.jl
>
>
>>
>> --Tim
>>
>> On Tuesday, March 11, 2014 04:17:17 AM J Luis wrote:
>> > I've been here before too (and will come back)
>> >
>> > An "addpath" would be a far far simpler to use solution.
>> >
>> > Terça-feira, 11 de Março de 2014 5:58:06 UTC, Ethan Anderes escreveu:
>> > > Thanks Kevin. I hadn't tried require since I wanted the ability to
>> chance
>> > > the scripts and re-include them. However, it appears require/reload
>> will
>> > > accomplish the same thing (although I guess I will need to change all
>> my
>> > > requires to reloads if I want it done without exiting the repl).
>> > >
>> > > Cheers,
>> > > Ethan
>> > >
>> > > On Monday, March 10, 2014 10:36:29 PM UTC-7, Kevin Squire wrote:
>> > >> If you use require("script.jl") instead of include, it will search
>> the
>> > >> LOAD_PATH.
>> > >>
>> > >> Cheers,
>> > >>
>> > >> Kevin
>> > >>
>> > >> On Mon, Mar 10, 2014 at 9:49 PM, Ethan Anderes
>> <[email protected]>wrote:
>> > >>> Hi,
>> > >>>
>> > >>> Is there an addpath equivalent from Matlab? Basically, I have a
>> > >>> directory that contains a bunch of scripts and modules. I've been
>> using
>> > >>> include to run the scripts but don't want to add the full path to
>> each
>> > >>> script. For example, dir is a directory which contains Mod.jl and
>> > >>> script.jl. The last line in the following code gives an error:
>> > >>>
>> > >>>
>> > >>> push!(LOAD_PATH, pwd()*"/dir")
>> > >>> using Mod # this works
>> > >>> include("script.jl") # this doesn't work
>> > >>>
>> > >>>
>> > >>> Is there a way to tell the repl to search in dir when I
>> > >>> include("script.jl")?
>> > >>>
>> > >>> Sorry if I missed this in the documentation...
>>
>