Compare commits

...

2 Commits

Author SHA1 Message Date
WerWolv
87efc6cf54 includes/std: Fixed std::string::contains function not checking last character 2022-08-16 09:48:42 +02:00
WerWolv
5e48adcb9d scripts: Properly open legacy hexproj files as UTF-8 2022-08-16 09:27:05 +02:00
2 changed files with 7 additions and 10 deletions

View File

@@ -39,15 +39,12 @@ namespace std::string {
};
fn contains(str a, str b) {
s32 a_len, b_len;
a_len = std::string::length(a);
b_len = std::string::length(b);
s32 a_len = std::string::length(a);
s32 b_len = std::string::length(b);
s32 i;
while (i < a_len - b_len) {
for (s32 i = 0, i <= (a_len - b_len), i += 1) {
if (std::string::substr(a, i, b_len) == b)
return true;
i = i + 1;
}
return false;

View File

@@ -4,7 +4,7 @@ from pathlib import Path
def extractData(projectName, jsonData, objectName, extension):
if objectName in jsonData:
with open(f"./{projectName}.{extension}", "w") as output:
with open(f"./{projectName}.{extension}", mode="w", encoding="utf-8") as output:
output.write(jsonData[objectName])
def main():
@@ -13,7 +13,7 @@ def main():
exit(1)
projectPath = sys.argv[1]
with open(projectPath, "r") as file:
with open(projectPath, mode="r", encoding="utf-8") as file:
jsonData = json.loads(file.read())
projectName = Path(projectPath).stem
@@ -22,7 +22,7 @@ def main():
extractData(projectName, jsonData, "pattern", "hexpat")
if "bookmarks" in jsonData:
with open(f"./{projectName}.hexbm", "w") as output:
with open(f"./{projectName}.hexbm", mode="w", encoding="utf-8") as output:
jsonOutput = {}
jsonOutput["bookmarks"] = jsonData["bookmarks"]
@@ -32,4 +32,4 @@ def main():
print(f"Project file used file {jsonData['filePath']}")
if __name__ == "__main__":
main()
main()