-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
+ OTRExporter and ZAPDTR as a submodule (archive) + fix paths when building on inside a dir with "." + add debug option + remove external xml folder patch
- Loading branch information
Showing
4 changed files
with
110 additions
and
171 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
From fb11cb1fc70f944feab290981b9e8d37e5ae6efc Mon Sep 17 00:00:00 2001 | ||
From: AltoXorg <[email protected]> | ||
Date: Thu, 9 Nov 2023 11:45:03 +0800 | ||
Subject: [PATCH] Use substr method to determine file extension | ||
|
||
Alternatively use the "find_last_of" & "substr" methods on this | ||
conveniently and performance wise. | ||
|
||
This fixes the "." problem where we are working currently on a | ||
directory that contains ".", which prior to this will get rid of any | ||
occurences of this character from the original path (when using | ||
std::accumulate without a binary operation). | ||
--- | ||
OTRExporter/Main.cpp | 20 +++++++++++--------- | ||
1 file changed, 11 insertions(+), 9 deletions(-) | ||
|
||
diff --git a/OTRExporter/Main.cpp b/OTRExporter/Main.cpp | ||
index b6a09cb..4fc3c48 100644 | ||
--- a/OTRExporter/Main.cpp | ||
+++ b/OTRExporter/Main.cpp | ||
@@ -174,15 +174,18 @@ static void ExporterProgramEnd() | ||
|
||
for (const auto& item : lst) | ||
{ | ||
- std::vector<std::string> splitPath = StringHelper::Split(item, "."); | ||
+ size_t filenameSepAt = item.find_last_of("/\\"); | ||
+ const std::string filename = item.substr(filenameSepAt + 1); | ||
|
||
- if (splitPath.size() >= 3) | ||
+ if (std::count(filename.begin(), filename.end(), '.') >= 2) | ||
{ | ||
- const std::string extension = splitPath.at(splitPath.size() - 1); | ||
- const std::string format = splitPath.at(splitPath.size() - 2); | ||
- splitPath.pop_back(); | ||
- splitPath.pop_back(); | ||
- std::string afterPath = std::accumulate(splitPath.begin(), splitPath.end(), std::string("")); | ||
+ size_t extensionSepAt = filename.find_last_of("."); | ||
+ size_t formatSepAt = filename.find_last_of(".", extensionSepAt - 1); | ||
+ | ||
+ const std::string extension = filename.substr(extensionSepAt + 1); | ||
+ const std::string format = filename.substr(formatSepAt + 1, extensionSepAt - formatSepAt - 1); | ||
+ std::string afterPath = item.substr(0, filenameSepAt + formatSepAt + 1); | ||
+ | ||
if (extension == "png" && (format == "rgba32" || format == "rgb5a1" || format == "i4" || format == "i8" || format == "ia4" || format == "ia8" || format == "ia16" || format == "ci4" || format == "ci8")) | ||
{ | ||
ZTexture tex(nullptr); | ||
@@ -208,8 +211,7 @@ static void ExporterProgramEnd() | ||
|
||
if (item.find("accessibility") != std::string::npos) | ||
{ | ||
- std::string extension = splitPath.at(splitPath.size() - 1); | ||
- splitPath.pop_back(); | ||
+ std::string extension = filename.substr(filename.find_last_of(".") + 1); | ||
if (extension == "json") | ||
{ | ||
const auto &fileData = DiskFile::ReadAllBytes(item); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.