mirror of https://github.com/xemu-project/xemu.git
ui: Retain default EEPROM path after generation
This commit is contained in:
parent
aa256cbafa
commit
119bfda6b6
|
@ -3007,7 +3007,6 @@ void qemu_init(int argc, char **argv, char **envp)
|
|||
fake_argv[fake_argc++] = g_strdup_printf("smbus-storage,file=%s",
|
||||
escaped_eeprom_path);
|
||||
free(escaped_eeprom_path);
|
||||
free((char*)eeprom_path);
|
||||
} else {
|
||||
char *msg = g_strdup_printf("Failed to generate eeprom file '%s'. Please check machine settings.", eeprom_path);
|
||||
xemu_queue_error_message(msg);
|
||||
|
|
|
@ -218,6 +218,11 @@ const char *xemu_settings_get_path(void)
|
|||
|
||||
const char *xemu_settings_get_default_eeprom_path(void)
|
||||
{
|
||||
static char *eeprom_path = NULL;
|
||||
if (eeprom_path != NULL) {
|
||||
return eeprom_path;
|
||||
}
|
||||
|
||||
char *base = SDL_GetPrefPath("xemu", "xemu");
|
||||
assert(base != NULL);
|
||||
size_t base_len = strlen(base);
|
||||
|
@ -238,7 +243,8 @@ const char *xemu_settings_get_default_eeprom_path(void)
|
|||
memcpy(path+base_len, name, name_len);
|
||||
path[final_len-1] = '\0';
|
||||
|
||||
return path;
|
||||
eeprom_path = path;
|
||||
return eeprom_path;
|
||||
}
|
||||
|
||||
static int xemu_enum_str_to_int(const struct enum_str_map *map, const char *str, int *value)
|
||||
|
|
Loading…
Reference in New Issue