From af729c527bd0f078813191bc4c2dff99c9af26b8 Mon Sep 17 00:00:00 2001 From: Username404-59 Date: Thu, 10 Jun 2021 17:25:59 +0200 Subject: [PATCH] Fix the previous commit by adding an outputFile string. --- src/main.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index a7d15d6..a323176 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -17,17 +17,20 @@ int main(int argc, char* argv[]) { if ((currentArg == "--printresult") || (currentArg == "-p")) printResult = true; else if (currentArg.starts_with("--target=")) { 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 uniqueFiles(files.begin(), files.end()); 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); if (printResult) cout << "~~~~[Yerbacon compilation result]~~~~\n\n" << "[WIP]\n" << transpiledString << "\n\n"; 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";