Fix the previous commit by adding an outputFile string.
This commit is contained in:
parent
c5d33fd480
commit
af729c527b
11
src/main.cpp
11
src/main.cpp
|
@ -17,17 +17,20 @@ int main(int argc, char* argv[]) {
|
||||||
if ((currentArg == "--printresult") || (currentArg == "-p")) printResult = true;
|
if ((currentArg == "--printresult") || (currentArg == "-p")) printResult = true;
|
||||||
else if (currentArg.starts_with("--target=")) {
|
else if (currentArg.starts_with("--target=")) {
|
||||||
currentArg.remove_prefix(9);
|
currentArg.remove_prefix(9);
|
||||||
target = currentArg;
|
target = '.';
|
||||||
|
target += currentArg;
|
||||||
}
|
}
|
||||||
else files.push_back(currentArg);
|
else if (currentArg.ends_with(".ybcon")) files.push_back(currentArg);
|
||||||
}
|
}
|
||||||
const set<string_view> uniqueFiles(files.begin(), files.end());
|
const set<string_view> uniqueFiles(files.begin(), files.end());
|
||||||
for (string_view fileName: uniqueFiles) {
|
for (string_view fileName: uniqueFiles) {
|
||||||
if (fileName != "none" and fileName.ends_with(".ybcon")) {
|
if (fileName != "none") {
|
||||||
const string transpiledString = transpile(parseString(getFileContent(fileName.data())), target);
|
const string transpiledString = transpile(parseString(getFileContent(fileName.data())), target);
|
||||||
if (printResult) cout << "~~~~[Yerbacon compilation result]~~~~\n\n" << "[WIP]\n" << transpiledString << "\n\n";
|
if (printResult) cout << "~~~~[Yerbacon compilation result]~~~~\n\n" << "[WIP]\n" << transpiledString << "\n\n";
|
||||||
fileName.remove_suffix(6);
|
fileName.remove_suffix(6);
|
||||||
outputFileContent(target.insert(0, fileName), transpiledString);
|
string outputFile;
|
||||||
|
outputFile.append(fileName); outputFile.append(target);
|
||||||
|
outputFileContent(outputFile, transpiledString);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else cout << "No valid file provided.\n";
|
} else cout << "No valid file provided.\n";
|
||||||
|
|
Loading…
Reference in New Issue