mirror of https://github.com/ArduPilot/ardupilot
AP_Scripting: ignore hidden Lua files
On macOS, sometimes ._script.lua is created to store metadata when the user copies script.lua over to their SD card. Previously, the scripting engine would barf since the file is not Lua. Now, these files are ignored. Also avoids a case where a hidden and valid script might be loaded without the user's knowledge.
This commit is contained in:
parent
e2ef47b221
commit
717c5ff863
|
@ -268,8 +268,8 @@ void lua_scripts::load_all_scripts_in_dir(lua_State *L, const char *dirname) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strncmp(&de->d_name[length-4], ".lua", 4)) {
|
if ((de->d_name[0] == '.') || strncmp(&de->d_name[length-4], ".lua", 4)) {
|
||||||
// doesn't end in .lua
|
// starts with . (hidden file) or doesn't end in .lua
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue