That pattern should be rewritten to:
Path.expand("some_file.ex", __DIR__)
or:
Path.join(__DIR__, "some_file.ex")
I don't believe we should introduce Path.relative_to_current_file because
it would have to be a macro in order to retrieve the current file and
__DIR__ is readable enough.
*José Valim*
www.plataformatec.com.br
Skype: jv.ptec
Founder and Director of R&D
On Fri, May 12, 2017 at 3:02 PM, Sam Davies <[email protected]> wrote:
> I've seen this pattern a lot:
>
> `Path.expand('./some_file.ex', Path.dirname(__ENV__.file))`
>
> which returns the path relative to the location of the file it is
> specified in.
>
> I wonder if we can package this up in a convenient helper method,
> something like:
>
> `Path.relative_to_file('./some_file.ex')` or
> `Path.relative_to_current_file('./some_file.ex')`
>
> --
> You received this message because you are subscribed to the Google Groups
> "elixir-lang-core" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit https://groups.google.com/d/ms
> gid/elixir-lang-core/c4b963b4-5c08-4b42-9fac-f7268c1d976c%40
> googlegroups.com
> <https://groups.google.com/d/msgid/elixir-lang-core/c4b963b4-5c08-4b42-9fac-f7268c1d976c%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4%2Bg11Erhb5ifvQCxrSHR%2B%3D8cvXuXxsypfU39OEAXMuYPg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.