I have been using to following to change my working directory to the location of my .jl scripts in Atom as follows without problems:
cd(dirname(@__FILE__))
When I run a script with this in vs code, I get an error and it doesn’t change my working directory:
julia> cd(dirname(@__FILE__))
ERROR: IOError: chdir : invalid argument (EINVAL)
Stacktrace:
[1] uv_error at .\libuv.jl:97 [inlined]
[2] cd(::String) at .\file.jl:84
[3] top-level scope at REPL[2]:1
The reason that is I think is because there is nothing in the strong for cd() to work on:
julia> @__FILE__
"REPL[1]"
julia> dirname(@__FILE__)
""
When I use Alt+Enter to evaluate it inline from within a script, then it works fine. But when I run the actual script I get the error message above.
Any ideas on what is going on?