Skip to content

Commit

Permalink
supports arguments (wow!)
Browse files Browse the repository at this point in the history
  • Loading branch information
Anonym271 committed Apr 18, 2021
1 parent 092a6ba commit 50e5ed3
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions main.cpp
Expand Up @@ -179,10 +179,28 @@ void unlzss(std::vector<uint8_t>& data)
data = std::move(output);
}

void usage_and_exit(int code = 0)
{
std::cout <<
"Usage: <me> <input-file> [output-dir]\n";
exit(code);
}

int main(int argc, const char** argv)
{
const std::string filename = "ui.bin";
const fs::path outpath = "ui_";
if (argc < 2 || argc > 4)
usage_and_exit();
fs::path filename = argv[1];
fs::path outpath;
if (argc == 2)
{
outpath = filename;
outpath.replace_extension();
}
else outpath = argv[2];

//const std::string filename = "ui.bin";
//const fs::path outpath = "ui_";

std::ifstream fin(filename, std::ios::binary);
if (!fin.is_open())
Expand Down

0 comments on commit 50e5ed3

Please sign in to comment.