AP_Scripting: Only try to make scripts directory if file write and directory is enabled

This commit is contained in:
Iampete1 authored and Andrew Tridgell committed 2024-03-12 08:52:38 +11:00
1 parent 466b4b6c2e
commit 90ad109047
1 file changed
+9 -4
+9 -4
View File
@@ -180,12 +180,17 @@ void AP_Scripting::init(void) {
return;
}
const char *dir_name = SCRIPTING_DIRECTORY;
if (AP::FS().mkdir(dir_name)) {
if (errno != EEXIST) {
GCS_SEND_TEXT(MAV_SEVERITY_INFO, "Scripting: failed to create (%s)", dir_name);
#if AP_FILESYSTEM_FILE_WRITING_ENABLED
if ((_dir_disable & uint16_t(AP_Scripting::SCR_DIR::SCRIPTS)) == 0) {
// Only try creating scripts directory if loading from it is enabled
const char *dir_name = SCRIPTING_DIRECTORY;
if (AP::FS().mkdir(dir_name)) {
if (errno != EEXIST) {
GCS_SEND_TEXT(MAV_SEVERITY_INFO, "Scripting: failed to create (%s)", dir_name);
}
}
}
#endif
AP_HAL::Scheduler::priority_base priority = AP_HAL::Scheduler::PRIORITY_SCRIPTING;
static const struct {