Check for masterlist before repo when getting revision.

It makes more sense to have "N/A" displayed instead of "Unknown" when
there's no file present.
This commit is contained in:
Oliver Hamlet
2015-04-26 19:06:22 +01:00
parent 3cf6a0bed8
commit 9116596bc9
+5 -5
View File
@@ -221,14 +221,14 @@ namespace loot {
git_handler git;
git.ui_message = (boost::format(lc::translate("An error occurred while trying to read the local masterlist's version. If this error happens again, try deleting the \".git\" folder in %1%.")) % path.parent_path().string()).str();
if (!isRepository(path.parent_path())) {
BOOST_LOG_TRIVIAL(info) << "Unknown masterlist revision: Git repository missing.";
throw error(error::ok, lc::translate("Unknown: Git repository missing"));
}
else if (!fs::exists(path)) {
if (!fs::exists(path)) {
BOOST_LOG_TRIVIAL(info) << "Unknown masterlist revision: No masterlist present.";
throw error(error::ok, lc::translate("N/A: No masterlist present"));
}
else if (!isRepository(path.parent_path())) {
BOOST_LOG_TRIVIAL(info) << "Unknown masterlist revision: Git repository missing.";
throw error(error::ok, lc::translate("Unknown: Git repository missing"));
}
BOOST_LOG_TRIVIAL(debug) << "Existing repository found, attempting to open it.";
git.call(git_repository_open(&git.repo, path.parent_path().string().c_str()));