-
Notifications
You must be signed in to change notification settings - Fork 64
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 access #1715
File access #1715
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes here look good to me. I have not yet tested the Rythm example though. However, instead of testing an example once, I think we should add integration tests for this feature.
I have added tests for both federated and unfederated versions. To get the federated test working, I had to resurrect the I believe this is ready to merge, modulo tests passing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to enable programs to read files located relative to the source .lf file.
Just a thought (not a conviction) -- Would it be preferable to have users read relative to the project root? This seems like a more popular choice among other programming languages, maybe to avoid long prefixes of ../../../
and to avoid having to change imports when the file that does the imports is moved.
We could also expose both paths.
I guess this would be FileConfig.outPath? I'm not sure. The documentation doesn't claim this to be a project root. Doesn't the notion of a project root depend on the IDE? |
I agree with @petervdonovan, and we have also discussed this previously. Yes, it should be possible to look relative to the file, but we should also be able (and encourage, for the above-stated reasons) to look relative to the project root. The project root is the parent directory of the |
I think that |
This sounds good to me. Can you clarify for me which FileConfig fields correspond to these? |
Looks like it should be |
Hmm. That says "This path is determined differently depending on whether the compiler is invoked through the IDE or from the command line." This means that the same program will work or fail depending on how the compiler is invoked. I think I will stick with the original design. |
It's really just the parent of the |
In Epoch, at least, the bin and src-gen directories go into a different place depending on where you set the root of the project. I have a project that includes all tests for all targets. It puts bin in lingua-franca/test, not lingua-franca/test/C, as the command-line does. |
I see. This makes it ambiguous as to what the project root is. IMO, a package layout where the |
How about we change the behavior slightly to get more uniformity? Let's determine the package root the same way for all environments and not treat Epoch specially. The only situation in which, I think, it makes sense to do so, is when there is no |
Sounds good to me. |
Finally got Windows to work! Merging now with main, and will add project root option as a separate PR. |
This is a companion to the file-access PR in reactor-c. It adds definitions for LF_SOURCE_DIRECTORY and LF_FILE_SEPARATOR to the generated cmake file to enable programs to read files located relative to the source
.lf
file.With these changes, the Rhythm examples in the examples repo work again, at least on MacOS. It would be great if someone could test them on Linux.