#define UNEXPANDED _T("$(FILE_PATH)")
-static void clearmountitems(struct uae_prefs *p)
-{
- p->mountitems = 0;
- for (int i = 0; i < MOUNT_CONFIG_SIZE; i++) {
- p->mountconfig[i].configoffset = -1;
- p->mountconfig[i].unitnum = -1;
- }
-}
-
-void discard_prefs(struct uae_prefs *p, int type)
-{
- struct strlist **ps = &p->all_lines;
- while (*ps) {
- struct strlist *s = *ps;
- *ps = s->next;
- xfree(s->value);
- xfree(s->option);
- xfree(s);
- }
- p->all_lines = NULL;
- currprefs.all_lines = changed_prefs.all_lines = NULL;
-#ifdef FILESYS
- filesys_cleanup();
-#endif
- clearmountitems(p);
-}
-
static TCHAR *cfgfile_unescape(const TCHAR *s, const TCHAR **endpos, TCHAR separator, bool min)
{
bool quoted = false;
c = s[i + 1];
switch (c)
{
- case 'X':
- case 'x':
- c2 = _totupper(s[i + 2]);
- v = ((c2 >= 'A') ? c2 - 'A' : c2 - '0') << 4;
- c2 = _totupper(s[i + 3]);
- v |= (c2 >= 'A') ? c2 - 'A' : c2 - '0';
- *p++ = c2;
- i += 2;
- break;
- case 'r':
- *p++ = '\r';
- break;
- case '\n':
- *p++ = '\n';
- break;
- default:
- *p++ = c;
- break;
+ case 'X':
+ case 'x':
+ c2 = _totupper(s[i + 2]);
+ v = ((c2 >= 'A') ? c2 - 'A' : c2 - '0') << 4;
+ c2 = _totupper(s[i + 3]);
+ v |= (c2 >= 'A') ? c2 - 'A' : c2 - '0';
+ *p++ = c2;
+ i += 2;
+ break;
+ case 'r':
+ *p++ = '\r';
+ break;
+ case 'n':
+ *p++ = '\n';
+ break;
+ default:
+ *p++ = c;
+ break;
}
i++;
- }
- else {
+ } else {
*p++ = c;
}
}
return cfgfile_unescape(s, NULL, 0, true);
}
+static void clearmountitems(struct uae_prefs *p)
+{
+ p->mountitems = 0;
+ for (int i = 0; i < MOUNT_CONFIG_SIZE; i++) {
+ p->mountconfig[i].configoffset = -1;
+ p->mountconfig[i].unitnum = -1;
+ }
+}
+
+void discard_prefs(struct uae_prefs *p, int type)
+{
+ struct strlist **ps = &p->all_lines;
+ while (*ps) {
+ struct strlist *s = *ps;
+ *ps = s->next;
+ xfree(s->value);
+ xfree(s->option);
+ xfree(s);
+ }
+ p->all_lines = NULL;
+ currprefs.all_lines = changed_prefs.all_lines = NULL;
+#ifdef FILESYS
+ filesys_cleanup();
+#endif
+ clearmountitems(p);
+}
+
static TCHAR *cfgfile_option_find_it(const TCHAR *s, const TCHAR *option, bool checkequals)
{
TCHAR buf[MAX_DPATH];
// quoted special case
if (tmpp2[0] == '\"') {
const TCHAR *end;
- TCHAR *n = cfgfile_unescape (tmpp2, &end, 0, false);
+ TCHAR *n = cfgfile_unescape (tmpp2, &end, 0, true);
if (!n)
goto invalid_fs;
_tcscpy (uci.rootdir, n);
// quoted special case
if (tmpp2[0] == '\"') {
const TCHAR *end;
- TCHAR *n = cfgfile_unescape (tmpp2, &end, 0, false);
+ TCHAR *n = cfgfile_unescape (tmpp2, &end, 0, true);
if (!n)
goto invalid_fs;
_tcscpy (uci.rootdir, n);
}
if (s) {
s++;
- bool quoted = false;
if (s[0] == '"') {
- s++;
- quoted = true;
- }
- const TCHAR *se = _tcschr(s, quoted ? '"' : ',');
- if (se) {
- tmp[se - tmp] = 0;
- _tcscpy(p->mountconfig[0].ci.rootdir, s);
- cfgfile_resolve_path_load(p->mountconfig[0].ci.rootdir, MAX_DPATH, isvsys ? PATH_DIR : PATH_HDF);
- p->mountitems = 1;
+ const TCHAR *end;
+ TCHAR *n = cfgfile_unescape(s, &end, 0, true);
+ _tcscpy(tmp, n);
+ s = tmp;
+ xfree(n);
+ } else {
+ const TCHAR *se = _tcschr(s, ',');
+ if (se) {
+ tmp[se - tmp] = 0;
+ }
}
+ _tcscpy(p->mountconfig[0].ci.rootdir, s);
+ cfgfile_resolve_path_load(p->mountconfig[0].ci.rootdir, MAX_DPATH, isvsys ? PATH_DIR : PATH_HDF);
+ p->mountitems = 1;
}
}
}