jak2: significantly reduce the verbosity of the game.gp file (#2103)

This commit is contained in:
Tyler Wilding
2023-01-28 20:15:58 -05:00
committed by GitHub
parent 18507bc78e
commit 3d097e69e1
12 changed files with 548 additions and 4574 deletions
+24
View File
@@ -5,6 +5,7 @@
#include "FileUtil.h"
#include <algorithm>
#include <cstdio> /* defines FILENAME_MAX */
#include <cstdlib>
#include <fstream>
@@ -338,6 +339,29 @@ std::string base_name_no_ext(const std::string& filename) {
;
}
std::string split_path_at(const fs::path& path, const std::vector<std::string>& folders) {
std::string split_str = "";
for (const auto& folder : folders) {
#ifdef _WIN32
split_str += folder + "\\";
#else
split_str += folder + "/";
#endif
}
const auto& path_str = path.u8string();
return path_str.substr(path_str.find(split_str) + split_str.length());
}
std::string convert_to_unix_path_separators(const std::string& path) {
#ifdef _WIN32
std::string copy = path;
std::replace(copy.begin(), copy.end(), '\\', '/');
return copy;
#else
return path;
#endif
}
void ISONameFromAnimationName(char* dst, const char* src) {
// The Animation Name is a bunch of words separated by dashes