27 #ifdef CRN_USING_GDKPB
28 # include <gdk-pixbuf/gdk-pixbuf.h>
30 #ifdef CRN_ENABLE_OPENMP
42 conf.SetData(topDirKey(),
Path(CRN_PROJECT_PATH));
43 if (!IO::Access(CRN_PROJECT_PATH, IO::EXISTS))
47 IO::Mkdir(CRN_PROJECT_PATH);
51 conf.SetData(localeDirKey(),
Path(CRN_LOCALE_FULL_PATH));
52 conf.SetData(staticDataDirKey(),
Path(CRN_DATA_FULL_PATH));
53 conf.SetData(verboseKey(), Prop3::True());
56 IO::IsVerbose() = conf.GetProp3(verboseKey()).IsTrue();
58 #ifdef CRN_USING_GDKPB
59 # if !GLIB_VERSION_2_36
65 char *loc = getenv(
"LANG");
66 CRNdout <<
"libcrn LANG env: " << (loc ==
nullptr ?
"none" : loc) << std::endl;
68 #if !defined(CRN_USING_GLIB_INTL) && !defined(CRN_USING_LIBINTL)
69 loc = setlocale(LC_ALL,
"C");
71 loc = setlocale(LC_ALL,
"");
75 CRNdout <<
"libcrn setlocale failed" << std::endl;
77 CRNdout <<
"libcrn locale = " << loc << std::endl;
81 CRNdout <<
"libcrn: no bound path. should be " << conf.GetPath(localeDirKey()).CStr() << std::endl;
83 CRNdout <<
"libcrn: path set to " << loc << std::endl;
86 CRNdout <<
"libcrn: no bound codeset. should be UTF-8" << std::endl;
88 CRNdout <<
"libcrn: Codeset = " << loc << std::endl;
91 CRNdout <<
"libcrn textdomain failed" << std::endl;
93 CRNdout <<
"libcrn text domain = " << loc << std::endl;
94 CRNdout <<
_(
"Using default language.") << std::endl;
101 Config& Config::getInstance()
107 String Config::topDirKey()
112 String Config::localeDirKey()
114 return U
"LocalePath";
117 String Config::staticDataDirKey()
119 return U
"StaticDataPath";
122 String Config::verboseKey()
138 getInstance().conf.
SetData(topDirKey(), dir);
146 return getInstance().conf.
GetPath(topDirKey());
154 return getInstance().conf.
GetPath(localeDirKey());
162 getInstance().conf.
SetData(localeDirKey(), dir);
170 return getInstance().conf.
GetPath(staticDataDirKey());
178 getInstance().conf.
SetData(staticDataDirKey(), dir);
void SetData(const String &key, T value)
Sets a key/value pair.
static crn::Path GetStaticDataPath()
Gets the data directory name.
static void SetTopDataPath(const Path &dir)
Sets the top directory name.
static bool Save()
Saves to user's local config.
bool IsNotEmpty() const noexcept
Checks if the string is not empty.
#define CRN_END_CLASS_CONSTRUCTOR(classname)
Defines a class constructor.
char * CRNbindtextdomain(const char *, const char *)
A UTF32 character string class.
static bool & IsVerbose()
Controls whether CRNVerbose prints something or not.
Global configuration utility class.
static void SetStaticDataPath(const crn::Path &dir)
Sets the data directory name.
A convenience class for file paths.
Path Save()
Saves the file to the user's personal space.
static void SetLocalePath(const crn::Path &dir)
Sets the translation files path.
char * CRNtextdomain(const char *)
static Path GetTopDataPath()
Gets the top directory name.
char * CRNbind_textdomain_codeset(const char *, const char *)
static crn::Path GetLocalePath()
Gets the translation files path.
Configuration file management utility class.
Path GetPath(const String &key) const
Gets a path.
#define CRN_BEGIN_CLASS_CONSTRUCTOR(classname)
Defines a class constructor.