mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-08-31 07:12:39 -06:00
.Core: GetIniFile
git-svn-id: svn://ultimatepp.org/upp/trunk@6385 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
55bc7666e3
commit
9456775d23
2 changed files with 9 additions and 3 deletions
|
|
@ -50,7 +50,7 @@ VectorMap<String, String> LoadIniFile(const char *filename)
|
|||
}
|
||||
|
||||
static StaticMutex sMtx;
|
||||
static char sIniFile[256];
|
||||
static char sIniFile[512];
|
||||
|
||||
int ini_version__ = 1;
|
||||
|
||||
|
|
@ -62,7 +62,7 @@ void ReloadIniFile()
|
|||
|
||||
void SetIniFile(const char *name) {
|
||||
Mutex::Lock __(sMtx);
|
||||
strcpy(sIniFile, name);
|
||||
strcpy(sIniFile, name, 511);
|
||||
ReloadIniFile();
|
||||
}
|
||||
|
||||
|
|
@ -78,6 +78,11 @@ bool IniChanged__(int version)
|
|||
}
|
||||
#endif
|
||||
|
||||
String GetIniFile()
|
||||
{
|
||||
return *sIniFile ? sIniFile : ~ConfigFile("q.ini")
|
||||
}
|
||||
|
||||
String GetIniKey(const char *id, const String& def) {
|
||||
ASSERT_(IsMainRunning(), "GetIniKey is allowed only after APP_MAIN has started");
|
||||
Mutex::Lock __(sMtx);
|
||||
|
|
@ -85,7 +90,7 @@ String GetIniKey(const char *id, const String& def) {
|
|||
static int version;
|
||||
if(version != ini_version__) {
|
||||
version = ini_version__;
|
||||
key = LoadIniFile(*sIniFile ? sIniFile : ~ConfigFile("q.ini"));
|
||||
key = LoadIniFile(GetIniFile());
|
||||
#ifdef PLATFORM_WIN32
|
||||
if(key.GetCount() == 0)
|
||||
key = LoadIniFile(~GetExeDirFile("q.ini"));
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ void SetAssertFailedHook(void (*h)(const char *));
|
|||
|
||||
void ReloadIniFile();
|
||||
void SetIniFile(const char *path = NULL);
|
||||
String GetIniFile();
|
||||
String GetIniKey(const char *id, const String& def);
|
||||
String GetIniKey(const char *id);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue