Merge remote-tracking branch 'origin/master'
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
This commit is contained in:
commit
3df014f332
|
@ -5,8 +5,9 @@ project(LangBuilder)
|
|||
add_compile_options(-Wall -Wextra -Werror)
|
||||
# We like new stuff, so set the c++ standard to c++20.
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(BUILD_SHARED_LIBS OFF)
|
||||
|
||||
file(GLOB_RECURSE SRC_FILES "src/*.cpp" "src/*.hpp")
|
||||
|
||||
add_executable(LangBuilder ${SRC_FILES})
|
||||
target_link_libraries(LangBuilder -static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ -lpthread)
|
||||
target_link_libraries(LangBuilder -static -static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ -lpthread)
|
|
@ -12,6 +12,10 @@ static bool IsKeyValid(const std::string_view & key){
|
|||
return true;
|
||||
}
|
||||
|
||||
const char PossibleSeparators[] = {
|
||||
',', ';', '|', '\t', ':'
|
||||
};
|
||||
|
||||
void LocalizationFile::LoadFile(const std::filesystem::path& path) {
|
||||
if (!std::filesystem::exists(path)) {
|
||||
std::stringstream ss;
|
||||
|
@ -31,9 +35,11 @@ void LocalizationFile::LoadFile(const std::filesystem::path& path) {
|
|||
while (std::getline(file, line)) {
|
||||
if (firstLine) {
|
||||
firstLine = false;
|
||||
if (line.substr(0, 4) == "sep=") {
|
||||
sep = line[4];
|
||||
continue;
|
||||
for (auto& s :PossibleSeparators) {
|
||||
if (line.find(s) != std::string::npos){
|
||||
sep = s;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
std::string key;
|
||||
|
@ -43,6 +49,8 @@ void LocalizationFile::LoadFile(const std::filesystem::path& path) {
|
|||
std::getline(linestream, value, sep);
|
||||
if (key.empty())
|
||||
continue;
|
||||
if (key == "key" && value == "value")
|
||||
continue;
|
||||
if (!IsKeyValid(key)){
|
||||
std::cout << "Key not valid: '" << key << "'. Skipping key." << std::endl;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue