Skip to content

Commit

Permalink
Fixed bug where default state file directory was wrong
Browse files Browse the repository at this point in the history
  • Loading branch information
nickgammon committed Aug 30, 2010
1 parent bdb4fda commit 7e29caa
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions globalregistryoptions.cpp
Expand Up @@ -134,13 +134,12 @@ int CMUSHclientApp::PopulateDatabase (void)
strcmp (AlphaGlobalOptionsTable [i].pName, "FixedPitchFont") == 0)
AlphaGlobalOptionsTable [i].sDefault = (LPCTSTR) m_strFixedPitchFont;

// For Willfa, see below
if (strcmp (AlphaGlobalOptionsTable [i].pName, "StateFilesDirectory") == 0)
AlphaGlobalOptionsTable [i].sDefault = (LPCTSTR) (App.m_strPluginsDirectory + "state\\");

CString strDefault = AlphaGlobalOptionsTable [i].sDefault;

CString strValue = GetProfileString ("Global prefs",
AlphaGlobalOptionsTable [i].pName,
AlphaGlobalOptionsTable [i].sDefault);
AlphaGlobalOptionsTable [i].pName,
strDefault);

strValue.Replace ("'", "''"); // fix up quotes

Expand Down Expand Up @@ -180,18 +179,21 @@ void CMUSHclientApp::LoadGlobalsFromDatabase (void)
{
const char * p = (const char *) this + AlphaGlobalOptionsTable [i].iOffset;

CString strDefault = AlphaGlobalOptionsTable [i].sDefault;
if (strcmp (AlphaGlobalOptionsTable [i].pName, "StateFilesDirectory") == 0)
{
strDefault = App.m_strPluginsDirectory;
strDefault += "state\\";
}

db_simple_query ((LPCTSTR) CFormat (
"SELECT value FROM prefs WHERE name = '%s'", (LPCTSTR) AlphaGlobalOptionsTable [i].pName),
db_value,
true,
AlphaGlobalOptionsTable [i].sDefault);
strDefault);

* (CString *) p = db_value.c_str ();

// for Willfa - make state directory default to plugins directory (whatever that is now) with state\ at the end
if (strcmp (AlphaGlobalOptionsTable [i].pName, "StateFilesDirectory") == 0)
AlphaGlobalOptionsTable [i].sDefault = (LPCTSTR) (App.m_strPluginsDirectory + "state\\");

};


Expand Down

0 comments on commit 7e29caa

Please sign in to comment.