Fix travis build issues.

This commit is contained in:
Anon 2016-09-10 22:27:30 -05:00
parent bda26cba1f
commit 6fc4349b91
3 changed files with 11 additions and 7 deletions

View File

@ -517,7 +517,9 @@ std::string RTrim(std::string & s) {
} }
std::string Trim(std::string & s) { std::string Trim(std::string & s) {
return LTrim(RTrim(s)); auto temp = RTrim(s);
auto temp2 = LTrim(temp);
return temp2;
} }
std::string Join(const std::vector<std::string>& elements, const char* const separator) { std::string Join(const std::vector<std::string>& elements, const char* const separator) {

View File

@ -38,10 +38,10 @@ void RefreshCheats() {
namespace CheatEngine { namespace CheatEngine {
CheatEngine::CheatEngine() { CheatEngine::CheatEngine() {
//Create folder and file for cheats if it doesn't exist //Create folder and file for cheats if it doesn't exist
FileUtil::CreateDir(FileUtil::GetExeDirectory() + "\\user\\cheats"); FileUtil::CreateDir(FileUtil::GetUserPath(D_USER_IDX) + "\\cheats");
char buffer[50]; char buffer[50];
sprintf(buffer, "%016llX", Loader::program_id); sprintf(buffer, "%016llX", Loader::program_id);
std::string file_path = FileUtil::GetExeDirectory() + "\\user\\cheats\\" + std::string(buffer) + ".txt"; std::string file_path = FileUtil::GetUserPath(D_USER_IDX) + "\\cheats\\" + std::string(buffer) + ".txt";
if (!FileUtil::Exists(file_path)) if (!FileUtil::Exists(file_path))
FileUtil::CreateEmptyFile(file_path); FileUtil::CreateEmptyFile(file_path);
cheats_list = ReadFileContents(); cheats_list = ReadFileContents();
@ -50,7 +50,7 @@ namespace CheatEngine {
std::vector<std::shared_ptr<ICheat>> CheatEngine::ReadFileContents() { std::vector<std::shared_ptr<ICheat>> CheatEngine::ReadFileContents() {
char buffer[50]; char buffer[50];
auto a = sprintf(buffer, "%016llX", Loader::program_id); auto a = sprintf(buffer, "%016llX", Loader::program_id);
std::string file_path = FileUtil::GetExeDirectory() + "\\user\\cheats\\" + std::string(buffer) + ".txt"; std::string file_path = FileUtil::GetUserPath(D_USER_IDX) + "\\cheats\\" + std::string(buffer) + ".txt";
std::string contents; std::string contents;
FileUtil::ReadFileToString(true, file_path.c_str(), contents); FileUtil::ReadFileToString(true, file_path.c_str(), contents);
@ -64,7 +64,8 @@ namespace CheatEngine {
std::string name; std::string name;
bool enabled = false; bool enabled = false;
for (int i = 0; i < lines.size(); i++) { for (int i = 0; i < lines.size(); i++) {
std::string current_line = Common::Trim(std::string(lines[i].c_str())); std::string current_line = std::string(lines[i].c_str());
current_line = Common::Trim(current_line);
if (current_line == "[Gateway]") { // Codetype header if (current_line == "[Gateway]") { // Codetype header
code_type = "Gateway"; code_type = "Gateway";
@ -113,7 +114,7 @@ namespace CheatEngine {
void CheatEngine::Save(std::vector<std::shared_ptr<ICheat>> cheats) { void CheatEngine::Save(std::vector<std::shared_ptr<ICheat>> cheats) {
char buffer[50]; char buffer[50];
auto a = sprintf(buffer, "%016llX", Loader::program_id); auto a = sprintf(buffer, "%016llX", Loader::program_id);
std::string file_path = FileUtil::GetExeDirectory() + "\\user\\cheats\\" + std::string(buffer) + ".txt"; std::string file_path = FileUtil::GetUserPath(D_USER_IDX) + "\\cheats\\" + std::string(buffer) + ".txt";
FileUtil::IOFile file = FileUtil::IOFile(file_path, "w+"); FileUtil::IOFile file = FileUtil::IOFile(file_path, "w+");
bool sectionGateway = false; bool sectionGateway = false;
for (auto& cheat : cheats) { for (auto& cheat : cheats) {

View File

@ -22,7 +22,8 @@ namespace CheatEngine {
*/ */
struct CheatLine { struct CheatLine {
CheatLine(std::string line) { CheatLine(std::string line) {
line = Common::Trim(std::string(line.c_str())); // remove '/0' characters if any. line = std::string(line.c_str()); // remove '/0' characters if any.
line = Common::Trim(line);
if (line.length() != 17) { if (line.length() != 17) {
type = -1; type = -1;
cheat_line = line; cheat_line = line;