Skip to content

Commit

Permalink
v1.1 update
Browse files Browse the repository at this point in the history
  • Loading branch information
KojoBailey authored Jan 27, 2024
1 parent 968d402 commit 8d8b680
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
4 changes: 4 additions & 0 deletions compile.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@ECHO OFF

echo Compiling...
g++ src/main.cpp icon/icon.res -o Handler.exe -std=c++20 -static -static-libgcc -static-libstdc++
14 changes: 14 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
#include <iostream>
#include <stdlib.h>
#include <filesystem>
#include <fstream>
#include <nlohmann/json.hpp>

namespace fs = std::filesystem;
using json = nlohmann::ordered_json;

void cout(std::string msg) {
std::cout << "> " + msg + "\n";
Expand All @@ -20,7 +23,18 @@ int main(int argc, char* argv[]) {
fs::current_path(path);
fs::path filepath = argv[1];

std::ifstream config_file("config.json");
json config = json::parse(config_file);
if (config["flags"].is_null()) {
config["flags"] = "--clean";
std::ofstream config_out("config.json");
config_out << config.dump(2);
}

std::string command = "UsmToolkit.exe convert " + filepath.filename().string();
if (config["flags"] != "") {
command += " " + to_string(config["flags"]);
}

system(command.c_str());
}

0 comments on commit 8d8b680

Please sign in to comment.