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";