Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@__FILE__ doesn't report current file in weaving context #263

Closed
ssfrr opened this issue Nov 27, 2019 · 5 comments
Closed

@__FILE__ doesn't report current file in weaving context #263

ssfrr opened this issue Nov 27, 2019 · 5 comments
Labels
Milestone

Comments

@ssfrr
Copy link

ssfrr commented Nov 27, 2019

when loading data it's often convenient to use @__FILE__ to reference files relative to the current file. During weaving that macro seems to evaluate to "none" though.

@pfitzseb pfitzseb added the bug label Nov 27, 2019
@kdheepak
Copy link

kdheepak commented Dec 4, 2019

Additionally @__DIR__ is the current working directory path instead of the directory the file is located in.

@pfitzseb
Copy link
Member

pfitzseb commented Dec 4, 2019

Just for the record -- we'll need to wrap everything Weave evaluates in something like CodeTools.withpath.

@kdheepak
Copy link

kdheepak commented Dec 4, 2019

Weave uses Core.eval in a SandBox module to evaluate expressions from the various formats after converting them into chunks.

obj = Core.eval(SandBox, expr)

We wouldn't be able to use CodeTools.withpath for this, right?

@aviatesk aviatesk added this to the v0.11 milestone May 17, 2020
@aviatesk
Copy link
Member

my hunch is adding something like this on eval_chunk will solve the problems.

I set this issue as a milestone for v0.11.

@pfitzseb
Copy link
Member

Yeah. Can also use something like https://github.com/JuliaDocs/DocumentationGenerator.jl/blob/d3c3ce4aa1dc9e3c813ac26d81023dda9d3dfc62/src/utils/rewrite.jl#L109-L117 if you don't want the dep on MacroTools.

aviatesk added a commit that referenced this issue Jun 10, 2020
aviatesk added a commit that referenced this issue Jun 10, 2020
aviatesk added a commit that referenced this issue Jun 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants