main.cpp: Remove useless optional usage

Signed-off-by: Username404 <w.iron.zombie@gmail.com>
This commit is contained in:
Username404 2023-10-18 10:36:01 +02:00
parent 7d5abdf9b5
commit 7a4549dafb
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
1 changed files with 5 additions and 5 deletions

View File

@ -52,22 +52,22 @@ int main(int argc, char* argv[]) {
#ifdef _OPENMP
if (not parallel) omp_set_num_threads(1);
#endif
optional<filesystem::path> 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;