-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompilerdrivercpp.cpp
More file actions
40 lines (36 loc) · 1.19 KB
/
Copy pathcompilerdrivercpp.cpp
File metadata and controls
40 lines (36 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <iostream>
#include <string>
#include <filesystem>
#include "Compiler/Compiler.h"
using std::string;
using std::cin;
using std::cout;
using std::endl;
using std::filesystem::directory_iterator;
int main() {
Compiler compiler;
while (true) {
cout << "Please enter the name of the file (without the extension) you want to compile, " <<
"type \"exit\" to stop compiling files or type \"all\" to compile all files in the directory. The avaiables files in the input directory are:" << endl;
string directory_path = "input";
for (const auto& file : directory_iterator(directory_path)) {
string filename = file.path().stem().string();
cout << "- " << filename << endl;
}
string filename;
cin >> filename;
if (filename == "exit") {
cout << "Exiting" << endl;
break;
}
else if (filename == "all") {
for (const auto& file : directory_iterator(directory_path)) {
string filename = file.path().stem().string();
compiler.compile(filename);
}
}
else {
compiler.compile(filename);
}
}
}