Add tip when save ventoy.json failed.

pull/1457/head
longpanda 2 years ago
parent 43e921878b
commit d1584c10b4

@ -88,6 +88,7 @@ typedef struct SYSINFO
char buildtime[128]; char buildtime[128];
int syntax_error; int syntax_error;
int invalid_config; int invalid_config;
int config_save_error;
int language; int language;
int pathcase; int pathcase;

@ -325,8 +325,7 @@ static int ventoy_api_sysinfo(struct mg_connection *conn, VTOY_JSON *json)
VTOY_JSON_FMT_SINT("invalid_config", g_sysinfo.invalid_config); VTOY_JSON_FMT_SINT("invalid_config", g_sysinfo.invalid_config);
g_sysinfo.invalid_config = 0; g_sysinfo.invalid_config = 0;
#if defined(_MSC_VER) || defined(WIN32) #if defined(_MSC_VER) || defined(WIN32)
VTOY_JSON_FMT_STRN("os", "windows"); VTOY_JSON_FMT_STRN("os", "windows");
#else #else
@ -349,6 +348,8 @@ static int ventoy_api_handshake(struct mg_connection *conn, VTOY_JSON *json)
VTOY_JSON_FMT_BEGIN(pos, JSON_BUFFER, JSON_BUF_MAX); VTOY_JSON_FMT_BEGIN(pos, JSON_BUFFER, JSON_BUF_MAX);
VTOY_JSON_FMT_OBJ_BEGIN(); VTOY_JSON_FMT_OBJ_BEGIN();
VTOY_JSON_FMT_SINT("status", 0); VTOY_JSON_FMT_SINT("status", 0);
VTOY_JSON_FMT_SINT("save_error", g_sysinfo.config_save_error);
g_sysinfo.config_save_error = 0;
VTOY_JSON_FMT_OBJ_END(); VTOY_JSON_FMT_OBJ_END();
VTOY_JSON_FMT_END(pos); VTOY_JSON_FMT_END(pos);
@ -3577,6 +3578,7 @@ int ventoy_http_writeback(void)
if (ret) if (ret)
{ {
vlog("Failed to write ventoy.json file.\n"); vlog("Failed to write ventoy.json file.\n");
g_sysinfo.config_save_error = 1;
} }
return 0; return 0;

@ -480,6 +480,7 @@ var g_vtoy_cur_language_en =
"STR_SECURE_BOOT_DISABLE": "Disable", "STR_SECURE_BOOT_DISABLE": "Disable",
"STR_SYNTAX_ERROR_TIP": "Syntax error detected in ventoy.json, so the configuration is not loaded!", "STR_SYNTAX_ERROR_TIP": "Syntax error detected in ventoy.json, so the configuration is not loaded!",
"STR_INVALID_CONFIG_TIP": "Invalid configuration detected in ventoy.json, so the configuration is not loaded!", "STR_INVALID_CONFIG_TIP": "Invalid configuration detected in ventoy.json, so the configuration is not loaded!",
"STR_CONFIG_SAVE_ERROR_TIP": "Failed to write ventoy.json file. Check VentoyPlugson.log for more details!",
"STR_XXX": "xxx" "STR_XXX": "xxx"
}; };
@ -615,7 +616,7 @@ var g_vtoy_cur_language_cn =
"STR_SECURE_BOOT_DISABLE": "未开启", "STR_SECURE_BOOT_DISABLE": "未开启",
"STR_SYNTAX_ERROR_TIP": "ventoy.json 文件中存在语法错误,配置未加载!", "STR_SYNTAX_ERROR_TIP": "ventoy.json 文件中存在语法错误,配置未加载!",
"STR_INVALID_CONFIG_TIP": "ventoy.json 文件中存在错误配置,配置未加载!", "STR_INVALID_CONFIG_TIP": "ventoy.json 文件中存在错误配置,配置未加载!",
"STR_CONFIG_SAVE_ERROR_TIP": "ventoy.json 文件写入失败,详细信息请参考 VentoyPlugson.log 文件!",
"STR_XXX": "xxx" "STR_XXX": "xxx"

Loading…
Cancel
Save