Issue 336 2

These patches consolidate the parse of command line options to ConfigManager.
In addition, it also parses a configuration file.
> OK. You mean that "file not found" is not error case for this method.

> How about adding file existent check to ConfigManager::loadConfFile()? If
caller checks file existence, we can handle only invalid format error here.
It think that it should be

> reported as an error.

Thank you for the suggestion. That sounds good.

I'll do it.




2014-08-12 11:56 GMT+09:00 Kouhei Sutou <notifications@github.com>:

> In server/src/ConfigManager.cc:
>
> > +		if (path.empty())
> > +			return false;
> > +
> > +		GKeyFile *keyFile = g_key_file_new();
> > +		if (!keyFile) {
> > +			MLPL_CRIT("Failed to call g_key_file_new().\n");
> > +			return false;
> > +		}
> > +		Reaper<GKeyFile> keyFileReaper(keyFile, g_key_file_unref);
> > +
> > +		GError *error = NULL;
> > +		gboolean succeeded =
> > +		  g_key_file_load_from_file(keyFile, path.c_str(),
> > +		                            G_KEY_FILE_NONE, &error);
> > +		if (!succeeded) {
> > +			MLPL_DBG("Failed to load config file: %s (%s)\n",
>
> OK. You mean that "file not found" is not error case for this method.
>
> How about adding file existent check to ConfigManager::loadConfFile()? If
> caller checks file existence, we can handle only invalid format error here.
> It think that it should be reported as an error.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/project-hatohol/hatohol/pull/365/files#r16093451>.
>