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

AP_Scripting: add ROMFS to lua path #26157

Merged
merged 1 commit into from
Feb 26, 2024
Merged

Conversation

IamPete1
Copy link
Member

@IamPete1 IamPete1 commented Feb 6, 2024

This allows require to find modules in ROMFS. Possibly helps with other file system methods too. Note that this adds the new search path even if we don't have ROMFS compiled in. I think it will be fine, but I have not tested.

Adding "./modules/?.lua;" "./modules/?/init.lua" to get to the same place relative to a script loaded in ROMFS does not seem to work, I'm not sure why.

This should allow a SD card script to require something from ROMFS, which using relative paths would not. Because of the ordering it should also mean a SD card version of the same file gets priority over a ROMFS copy. Its convenient for development but might give users a very exciting way to break stuff. We could swap the ordering so ROMFS takes priority. Again, I have not tested this.

@rmackay9
Copy link
Contributor

rmackay9 commented Feb 6, 2024

This resolves #26155

@IamPete1 IamPete1 marked this pull request as ready for review February 23, 2024 01:24
@IamPete1
Copy link
Member Author

This now works as expected while abiding by SCR_DIR_DISABLE, the approach using defines is not very scalable it would fall over if we added another directory, but for now it keeps it simple.

@tridge tridge merged commit b7dd432 into ArduPilot:master Feb 26, 2024
92 checks passed
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.

4 participants