@@ -141,6 +141,26 @@ static EFI_STATUS get_the_system_log_file_name(log_file_type file, UINTN file_si
141141 if (FALSE == g_log_file_table [SYSTEM_LOG_AR_FILE ].name_initialized ) {
142142 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 );
143143 if (EFI_SUCCESS == efi_status ) {
144+ // Overwrite environment variables
145+ // Find the environment variable control chars
146+ p_env_start = strchr (g_log_file_table [SYSTEM_LOG_AR_FILE ].file_name , ENVIRONMENT_VARIABLE_CHAR_START );
147+ if (NULL != p_env_start )
148+ {
149+ p_env_start ++ ; // start + 1 cause we have to skip the ENVIRONMENT_VARIABLE_CHAR_START char
150+ p_env_stop = strchr (p_env_start , ENVIRONMENT_VARIABLE_CHAR_STOP );
151+ if (NULL != p_env_stop ) {
152+ // Replace the environment variable with the real value
153+ environment_variable [0 ] = 0 ; // Initialize the environemt variable string as empty
154+ strncat_s (environment_variable , ENVIRONMENT_VARIABLE_MAX_LEN , p_env_start , p_env_stop - p_env_start );
155+ if (NULL != (p_env_variable_path = getenv (environment_variable ))) {
156+ snprintf (temp_file_name , SYSTEM_LOG_FILE_NAME_MAX_LEN , "%s" , p_env_variable_path );
157+ }
158+ p_env_stop ++ ; // stop + 1 cause we have to skip the ENVIRONMENT_VARIABLE_CHAR_STOP char
159+ strcat_s (temp_file_name , SYSTEM_LOG_FILE_NAME_MAX_LEN , p_env_stop );
160+ // Store the proper file name
161+ strncpy_s (g_log_file_table [SYSTEM_LOG_AR_FILE ].file_name , SYSTEM_LOG_FILE_NAME_MAX_LEN , temp_file_name , SYSTEM_LOG_FILE_NAME_MAX_LEN );
162+ }
163+ }
144164 g_log_file_table [SYSTEM_LOG_AR_FILE ].name_initialized = TRUE;
145165 }
146166 }
0 commit comments