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

Remove interpreter needing to be relative to "share" directory #19

Closed
wants to merge 5 commits into from

Conversation

Vici37
Copy link
Contributor

@Vici37 Vici37 commented Feb 27, 2024

This PR uses the baked_file_system shard to add the entire share directory to the built binary, and then adds various monkey patches to allow the prelude to read those files from the virtual filesystem if they don't exist in their expected location.

This allows the constructed ic binary to not need a lib specific setup / build, and can potentially be run on machines without crystal installed at all (but still require the linked dynamic libraries).

Let me know if you find this useful, or don't wish to make such edits or updates to the interpreter directly :)

# with the only update being to support reading files from FileStorage
private def require_file(node : Require, filename : String)
parser = @program.new_parser(
File.exists?(filename) ? File.read(filename) : FileStorage.get(filename).gets_to_end
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only this line was changed in the copy/paste of the method.

@Vici37
Copy link
Contributor Author

Vici37 commented Feb 29, 2024

Hm, I still think this is a cool idea, but I keep finding more places in the compiler / interpreter that assumes direct file access that breaks because of this change. I'm gonna close this for now and keep at it on my own machine. Give a shout if you're interested in this idea, at least :)

@Vici37 Vici37 closed this Feb 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant