From 7a4549dafb1335904303aa14e81723c174cdf109 Mon Sep 17 00:00:00 2001 From: Username404 Date: Wed, 18 Oct 2023 10:36:01 +0200 Subject: [PATCH] main.cpp: Remove useless optional usage Signed-off-by: Username404 --- src/main.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 9315327..c32bf8e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -52,22 +52,22 @@ int main(int argc, char* argv[]) { #ifdef _OPENMP if (not parallel) omp_set_num_threads(1); #endif - optional file_path; + filesystem::path file_path; if (not text_provided) file_path = mount(currentArgument); Units.insert_or_assign(currentArgument, async(not parallel ? launch::deferred : launch::async, [&, currentArgument, file_path, index = Units.size() + 1]() { unit_result resultingPair; try { resultingPair.first = Target::forName(target, newLines)->transpileWithTree( - parseString(text_provided ? string(currentArgument) + '\n' : getFileContent(file_path->string(/* NOTE: This string is expected to finish with a line ending */))) + parseString(text_provided ? string(currentArgument) + '\n' : getFileContent(file_path.string(/* NOTE: This string is expected to finish with a line ending */))) ); if (!text_provided or output_directory.has_value()) outputFileContent( - (not output_directory.has_value() ? filesystem::path(file_path.value()) + (not output_directory.has_value() ? filesystem::path(file_path) : output_directory->append( - (not text_provided) ? file_path->filename().string() : to_string(index)) + (not text_provided) ? file_path.filename().string() : to_string(index)) ).replace_extension(target).string(), resultingPair.first); } catch (const Yerbacon::Exception& error) { - resultingPair.first = file_path.has_value() ? file_path->filename().string() : string(); + resultingPair.first = not text_provided ? file_path.filename().string() : string(); resultingPair.second.emplace(error); } return resultingPair;