Skip to content
Snippets Groups Projects
Commit 906b193a authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Fix case-sensitivity issue in charset element of path in last commit

fexistcase() only corrects the case of the filename, not the directories in
the path. So we'll just use the lowercase version of the charset string,
always.

Also, return false upon failure of any call to replace_text(), not just the
last one.
parent 74a75b28
No related branches found
No related tags found
No related merge requests found
Pipeline #8229 passed
......@@ -117,16 +117,24 @@ void sbbs_t::revert_text(void)
bool sbbs_t::load_user_text(void)
{
char path[MAX_PATH + 1];
char charset[16];
SAFECOPY(charset, term_charset());
strlwr(charset);
revert_text();
safe_snprintf(path, sizeof path, "%s%s/text.ini", cfg.ctrl_dir, term_charset());
if(fexistcase(path))
replace_text(path);
snprintf(path, sizeof path, "%s%s/text.ini", cfg.ctrl_dir, charset);
if (fexist(path)) {
if (!replace_text(path))
return false;
}
if (*useron.lang == '\0')
return true;
safe_snprintf(path, sizeof path, "%s%s/text.%s.ini", cfg.ctrl_dir, term_charset(), useron.lang);
if(fexistcase(path))
replace_text(path);
safe_snprintf(path, sizeof path, "%stext.%s.ini", cfg.ctrl_dir, useron.lang);
snprintf(path, sizeof path, "%s%s/text.%s.ini", cfg.ctrl_dir, charset, useron.lang);
if (fexist(path)) {
if (!replace_text(path))
return false;
}
snprintf(path, sizeof path, "%stext.%s.ini", cfg.ctrl_dir, useron.lang);
return replace_text(path);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment