diff --git a/libraries/AP_Scripting/lua_scripts.cpp b/libraries/AP_Scripting/lua_scripts.cpp index a3e587c53e6a0..03c94921136f9 100644 --- a/libraries/AP_Scripting/lua_scripts.cpp +++ b/libraries/AP_Scripting/lua_scripts.cpp @@ -255,10 +255,13 @@ void lua_scripts::load_all_scripts_in_dir(lua_State *L, const char *dirname) { if (dirname == nullptr) { return; } - auto *d = AP::FS().opendir(dirname); if (d == nullptr) { - GCS_SEND_TEXT(MAV_SEVERITY_WARNING, "Lua: open directory (%s) failed", dirname); + // this disk_space check will return 0 if we don't have a real + // filesystem (ie. no Posix or FatFs). Do not warn in this case. + if (AP::FS().disk_space(dirname) != 0) { + GCS_SEND_TEXT(MAV_SEVERITY_WARNING, "Lua: open directory (%s) failed", dirname); + } return; }