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

Make the system macro call set the current working directory #2784

Closed
wants to merge 1 commit into from

Conversation

asterite
Copy link
Member

@asterite asterite commented Jun 9, 2016

Fixes #2750

I think it makes more sense. If I have:

{{ `cat foo.txt`.stringify }}

I'd expect "foo.txt" to be relative to the file where the macro is defined. This makes builds reproducible, which doesn't happen right now because this basically depends on the current working directory where the program is compiled.

I know that __DIR__ can be used, but when dealing with files it will always have to be used, which makes things more verboise and harder to understand.

@jhass
Copy link
Member

jhass commented Jun 9, 2016

The real problem is hardcoding either variant, it should be configurable.

@bcardiff
Copy link
Member

bcardiff commented Jun 9, 2016

Is there a way to get the project root dir? It's another dir that might be useful.

It's hard to find a configuration option in a syntax with backticks.

`cat file.txt`@__DIR__ 

ugly as hell, right?

Maybe we could preserve the current directiory somehow (?)

@ysbaddaden
Copy link
Contributor

Previously to target a relative file we used __DIR__ and did nothing to get the current working directory.

Now, we do nothing to target a relative file, but how do we target files in the working directory? Is it possible?

@asterite
Copy link
Member Author

asterite commented Jun 9, 2016

What's the use case for getting files in the working directory where you are compiling a file?

@asterite
Copy link
Member Author

On second thought, it's true that with __DIR__ one can refer to the current directory, and with this change there's no way to refer to a file relative to the place where you are compiling things. I don't know if that has a use case or not, but if one day we find one it would be bad if we couldn't use it.

I'll close this.

@asterite asterite closed this Jun 10, 2016
@asterite asterite deleted the feature/system_chdir branch June 10, 2016 13:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants