AP_Logger: AP_Logger_File: Set custom log directory in init

`_log_directory` was used before `ensure_log_directory_exists`,
to fetch the log path

Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
This commit is contained in:
Patrick José Pereira 2020-10-19 15:27:06 -03:00 committed by Peter Barker
parent cbc3384187
commit 258083a6f2

View File

@ -62,11 +62,6 @@ void AP_Logger_File::ensure_log_directory_exists()
int ret;
struct stat st;
const char* custom_dir = hal.util->get_custom_log_directory();
if (custom_dir != nullptr){
_log_directory = custom_dir;
}
EXPECT_DELAY_MS(3000);
ret = AP::FS().stat(_log_directory, &st);
if (ret == -1) {
@ -105,6 +100,11 @@ void AP_Logger_File::Init()
_initialised = true;
hal.scheduler->register_io_process(FUNCTOR_BIND_MEMBER(&AP_Logger_File::_io_timer, void));
const char* custom_dir = hal.util->get_custom_log_directory();
if (custom_dir != nullptr){
_log_directory = custom_dir;
}
}
bool AP_Logger_File::file_exists(const char *filename) const