mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Fixed loot_masterlist_update() invalid path exception.
This commit is contained in:
@@ -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
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user