Fix issues with reading system3.ini and playlist made on Windows

- Replace backslashes in pathnames with slashes
- Strip '\r' in playlist
This commit is contained in:
kichikuou
2021-11-27 13:23:11 +09:00
parent dc471399e5
commit 80ea44e3c6
2 changed files with 19 additions and 7 deletions
+12 -3
View File
@@ -26,6 +26,15 @@ bool to_bool(const char *s, int lineno)
return true;
}
std::string normalize_path(std::string s)
{
for (char& c : s) {
if (c == '\\')
c = '/';
}
return s;
}
bool is_empty_line(const char *s)
{
for (; *s; s++) {
@@ -132,11 +141,11 @@ void Config::load_ini()
if (!strcasecmp(key, "noantialias"))
no_antialias = to_bool(val, lineno);
else if (!strcasecmp(key, "savedir"))
save_dir = val;
save_dir = normalize_path(val);
else if (!strcasecmp(key, "fontfile"))
font_file = val;
font_file = normalize_path(val);
else if (!strcasecmp(key, "playlist"))
playlist = val;
playlist = normalize_path(val);
else if (!strcasecmp(key, "fm"))
use_fm = to_bool(val, lineno);
else if (!strcasecmp(key, "game"))