fs/io/Reader: use C++ exceptions instead of class Error

This commit is contained in:
Max Kellermann
2015-12-16 11:05:33 +01:00
parent fe60c52c70
commit e6e7d6dbd6
33 changed files with 192 additions and 334 deletions

View File

@@ -277,13 +277,7 @@ static void help(void)
class ConfigLoader
{
Error &error;
bool result;
public:
ConfigLoader(Error &_error) : error(_error), result(false) { }
bool GetResult() const { return result; }
bool TryFile(const Path path);
bool TryFile(const AllocatedPath &base_path,
PathTraitsFS::const_pointer path);
@@ -292,7 +286,7 @@ public:
bool ConfigLoader::TryFile(Path path)
{
if (FileExists(path)) {
result = ReadConfigFile(path, error);
ReadConfigFile(path);
return true;
}
return false;
@@ -386,15 +380,16 @@ parse_cmdline(int argc, char **argv, struct options *options,
return false;
}
return ReadConfigFile(Path::FromFS(buffer), error);
ReadConfigFile(Path::FromFS(buffer));
#else
return ReadConfigFile(Path::FromFS(config_file), error);
ReadConfigFile(Path::FromFS(config_file));
#endif
return true;
}
/* use default configuration file path */
ConfigLoader loader(error);
ConfigLoader loader;
bool found =
#ifdef WIN32
@@ -413,5 +408,5 @@ parse_cmdline(int argc, char **argv, struct options *options,
return false;
}
return loader.GetResult();
return true;
}