Skip to content

Commit

Permalink
Add @__DIR__ macro. (JuliaLang#281)
Browse files Browse the repository at this point in the history
* Add @__DIR__ macro.

* Correct version number.
  • Loading branch information
helgee authored and dpsanders committed Feb 1, 2017
1 parent 745eb5b commit 78919e6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ Currently, the `@compat` macro supports the following syntaxes:

* `Compat.@blasfunc` makes functionality of `Base.LinAlg.BLAS.@blasfunc` available on older Julia versions

* `@__DIR__` has been added [#18380](https://github.com/JuliaLang/julia/pull/18380)

## Other changes

* `remotecall`, `remotecall_fetch`, `remotecall_wait`, and `remote_do` have the function to be executed remotely as the first argument in Julia 0.5. Loading `Compat` defines the same methods in older versions of Julia. [#13338](https://github.com/JuliaLang/julia/pull/13338)
Expand Down
5 changes: 5 additions & 0 deletions src/Compat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1463,4 +1463,9 @@ if VERSION < v"0.6.0-dev.374"
end
end

if VERSION < v"0.6.0-dev.528"
macro __DIR__() Base.source_dir() end
export @__DIR__
end

end # module
2 changes: 2 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1381,3 +1381,5 @@ let filename = tempname()
@test contains(ret, "WARNING: hello")
rm(filename)
end

@test @__DIR__() == dirname(@__FILE__)

0 comments on commit 78919e6

Please sign in to comment.