mirror of
https://github.com/hazemKrimi/jack-vm-translator.git
synced 2026-05-01 18:00:27 +00:00
fix: handle non existing vm file passed as argument
This commit is contained in:
@@ -13,6 +13,11 @@
|
|||||||
|
|
||||||
int process(std::string inputPath, std::string outputPath,
|
int process(std::string inputPath, std::string outputPath,
|
||||||
std::ios_base::openmode outputStreamMode, bool &init) {
|
std::ios_base::openmode outputStreamMode, bool &init) {
|
||||||
|
if (!std::filesystem::exists(inputPath)) {
|
||||||
|
std::cerr << "File does not exist!" << std::endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
std::ifstream ifs(inputPath);
|
std::ifstream ifs(inputPath);
|
||||||
std::ofstream ofs(outputPath, outputStreamMode);
|
std::ofstream ofs(outputPath, outputStreamMode);
|
||||||
std::string fileName = getFileNameFromFilePath(inputPath);
|
std::string fileName = getFileNameFromFilePath(inputPath);
|
||||||
|
|||||||
Reference in New Issue
Block a user