Add a non-ASCII character to testing root path and fix tests that broke

This commit is contained in:
Oliver Hamlet
2018-10-20 12:48:12 +01:00
parent 1d16b6cb70
commit 6f0d2116ba
4 changed files with 12 additions and 12 deletions
+2 -2
View File
@@ -65,7 +65,7 @@ void LoadOrderHandler::Init(const GameType& gameType,
}
const char* gameLocalDataPath = nullptr;
string tempPathString = gameLocalAppData.string();
string tempPathString = gameLocalAppData.u8string();
if (!tempPathString.empty())
gameLocalDataPath = tempPathString.c_str();
@@ -76,7 +76,7 @@ void LoadOrderHandler::Init(const GameType& gameType,
}
int ret = lo_create_handle(
&gh_, mapGameId(gameType), gamePath.string().c_str(), gameLocalDataPath);
&gh_, mapGameId(gameType), gamePath.u8string().c_str(), gameLocalDataPath);
HandleError("create a game handle", ret);
}
+4 -4
View File
@@ -114,7 +114,7 @@ void GitHelper::Open(const std::filesystem::path& repoRoot) {
logger_->info("Attempting to open Git repository at: {}",
repoRoot.string());
}
Call(git_repository_open(&data_.repo, repoRoot.string().c_str()));
Call(git_repository_open(&data_.repo, repoRoot.u8string().c_str()));
}
void GitHelper::SetRemoteUrl(const std::string& remote,
@@ -150,7 +150,7 @@ void GitHelper::Call(int error_code) {
bool GitHelper::IsRepository(const std::filesystem::path& path) {
return git_repository_open_ext(NULL,
path.string().c_str(),
path.u8string().c_str(),
GIT_REPOSITORY_OPEN_NO_SEARCH,
NULL) == 0;
}
@@ -208,7 +208,7 @@ void GitHelper::Clone(const std::filesystem::path& path,
// Perform the clone.
Call(git_clone(&data_.repo,
url.c_str(),
repoPath.string().c_str(),
repoPath.u8string().c_str(),
&data_.clone_options));
// If repo was cloned into a temporary directory, move it into the target
@@ -591,7 +591,7 @@ bool GitHelper::IsFileDifferent(const std::filesystem::path& repoRoot,
logger->trace("Existing repository found, attempting to open it.");
}
GitHelper git;
git.Call(git_repository_open(&git.data_.repo, repoRoot.string().c_str()));
git.Call(git_repository_open(&git.data_.repo, repoRoot.u8string().c_str()));
// Perform a git diff, then iterate the deltas to see if one exists for the
// masterlist.
+4 -4
View File
@@ -58,9 +58,9 @@ Plugin::Plugin(const GameType gameType,
std::filesystem::path filepath = dataPath / name_;
// In case the plugin is ghosted.
if (!std::filesystem::exists(filepath) &&
std::filesystem::exists(filepath.string() + ".ghost"))
if (!std::filesystem::exists(filepath)) {
filepath += ".ghost";
}
Load(filepath, gameType, headerOnly);
@@ -241,7 +241,7 @@ bool Plugin::IsValid(const std::string& filename,
bool isValid;
auto path = dataPath / filename;
int ret = esp_plugin_is_valid(
GetEspluginGameId(gameType), path.string().c_str(), true, &isValid);
GetEspluginGameId(gameType), path.u8string().c_str(), true, &isValid);
if (ret != ESP_OK || !isValid) {
if (logger) {
@@ -274,7 +274,7 @@ void Plugin::Load(const std::filesystem::path& path,
bool headerOnly) {
::Plugin* plugin;
int ret = esp_plugin_new(
&plugin, GetEspluginGameId(gameType), path.string().c_str());
&plugin, GetEspluginGameId(gameType), path.u8string().c_str());
if (ret != ESP_OK) {
throw FileAccessError(path.string() +
" : esplugin error code: " + std::to_string(ret));
+2 -2
View File
@@ -43,11 +43,11 @@ namespace loot {
namespace test {
std::filesystem::path getRootTestPath() {
auto directoryName = "LOOT-" + boost::lexical_cast<std::string>(
auto directoryName = u8"LOOT-t\u00E9st-" + boost::lexical_cast<std::string>(
(boost::uuids::random_generator())());
return std::filesystem::absolute(std::filesystem::temp_directory_path() /
directoryName);
std::filesystem::u8path(directoryName));
}
class CommonGameTestFixture : public ::testing::TestWithParam<GameType> {