create temp dir if it doesn't exist
#include <Debug.h>
#include <PrintLib.h>
#include "s_str.h"
+#include "os.h"
#if defined(__LINUX__)
#include <safe_str_lib.h>
@@ -132,6 +133,20 @@ static EFI_STATUS get_the_system_log_file_name(log_file_type file, UINTN file_si
CHAR8 *p_env_variable_path;
CHAR8 *p_env_start = NULL;
CHAR8 *p_env_stop = NULL;
+ static BOOLEAN temp_dir_created = FALSE;
+
+ // Check if the TEMP_FILE_DIR exists and create it if not
+ if (FALSE == temp_dir_created) {
+ if (FALSE == g_log_file_table[SYSTEM_LOG_AR_FILE].name_initialized) {
+ efi_status = preferences_get_string_ascii(g_log_file_table[SYSTEM_LOG_AR_FILE].ini_entry_name, guid, SYSTEM_LOG_FILE_NAME_MAX_LEN, g_log_file_table[SYSTEM_LOG_AR_FILE].file_name);
+ if (EFI_SUCCESS == efi_status) {
+ g_log_file_table[SYSTEM_LOG_AR_FILE].name_initialized = TRUE;
+ }
+ }
+ // Create the TMEP_FILE_DIR
+ os_mkdir(g_log_file_table[SYSTEM_LOG_AR_FILE].file_name);
+ temp_dir_created = TRUE;
+ }
if (FALSE == g_log_file_table[file].name_initialized) {
// The system log file name not configured yet, check the preferences
