Fixed loot_masterlist_update() invalid path exception.

This commit is contained in:
Oliver Hamlet
2015-01-03 21:54:16 +00:00
parent 1082157297
commit 8287010ec3
2 changed files with 4 additions and 2 deletions
+2
View File
@@ -482,6 +482,8 @@ LOOT_API unsigned int loot_update_masterlist(loot_db db,
bool * const updated) {
if (db == nullptr || masterlistPath == nullptr || remoteURL == nullptr || remoteBranch == nullptr || updated == nullptr)
return c_error(loot_error_invalid_args, "Null pointer passed.");
if (!boost::filesystem::is_directory(boost::filesystem::path(masterlistPath).parent_path()))
return c_error(loot_error_invalid_args, "Given masterlist path \"" + std::string(masterlistPath) + "\" does not have a valid parent directory.");
*updated = false;
+2 -2
View File
@@ -152,8 +152,8 @@ TEST_F(OblivionAPIOperationsTest, UpdateMasterlist) {
EXPECT_EQ(loot_error_invalid_args, loot_update_masterlist(db, masterlistPath.string().c_str(), "https://github.com/loot/oblivion.git", NULL, &updated));
EXPECT_EQ(loot_error_invalid_args, loot_update_masterlist(db, masterlistPath.string().c_str(), "https://github.com/loot/oblivion.git", "master", NULL));
EXPECT_EQ(loot_error_git_error, loot_update_masterlist(db, ";//\?", "https://github.com/loot/oblivion.git", "master", &updated));
EXPECT_EQ(loot_error_git_error, loot_update_masterlist(db, "", "https://github.com/loot/oblivion.git", "master", &updated));
EXPECT_EQ(loot_error_invalid_args, loot_update_masterlist(db, ";//\?", "https://github.com/loot/oblivion.git", "master", &updated));
EXPECT_EQ(loot_error_invalid_args, loot_update_masterlist(db, "", "https://github.com/loot/oblivion.git", "master", &updated));
EXPECT_EQ(loot_error_git_error, loot_update_masterlist(db, masterlistPath.string().c_str(), "https://github.com/loot/oblivion-does-not-exist.git", "master", &updated));
EXPECT_EQ(loot_error_git_error, loot_update_masterlist(db, masterlistPath.string().c_str(), "https://github.com/loot/oblivion.git", "missing-branch", &updated));
EXPECT_EQ(loot_error_git_error, loot_update_masterlist(db, masterlistPath.string().c_str(), "https://github.com/loot/oblivion.git", "", &updated));