From 60a4da8e204223d09c55cee0d4e9a586ecd95982 Mon Sep 17 00:00:00 2001 From: Ralf Donau Date: Sat, 21 Aug 2021 23:10:59 +0200 Subject: [PATCH] Utilities: Use File.error_string() instead of perror(3) in cpp-* --- Userland/Utilities/cpp-lexer.cpp | 2 +- Userland/Utilities/cpp-parser.cpp | 2 +- Userland/Utilities/cpp-preprocessor.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Userland/Utilities/cpp-lexer.cpp b/Userland/Utilities/cpp-lexer.cpp index 4b713f6217..528f231405 100644 --- a/Userland/Utilities/cpp-lexer.cpp +++ b/Userland/Utilities/cpp-lexer.cpp @@ -17,7 +17,7 @@ int main(int argc, char** argv) auto file = Core::File::construct(path); if (!file->open(Core::OpenMode::ReadOnly)) { - perror("open"); + warnln("Failed to open {}: {}", path, file->error_string()); exit(1); } auto content = file->read_all(); diff --git a/Userland/Utilities/cpp-parser.cpp b/Userland/Utilities/cpp-parser.cpp index 5ce02563cf..89ca66d8b6 100644 --- a/Userland/Utilities/cpp-parser.cpp +++ b/Userland/Utilities/cpp-parser.cpp @@ -21,7 +21,7 @@ int main(int argc, char** argv) path = "Source/little/main.cpp"; auto file = Core::File::construct(path); if (!file->open(Core::OpenMode::ReadOnly)) { - perror("open"); + warnln("Failed to open {}: {}", path, file->error_string()); exit(1); } auto content = file->read_all(); diff --git a/Userland/Utilities/cpp-preprocessor.cpp b/Userland/Utilities/cpp-preprocessor.cpp index e8f185cf37..2266315359 100644 --- a/Userland/Utilities/cpp-preprocessor.cpp +++ b/Userland/Utilities/cpp-preprocessor.cpp @@ -19,7 +19,7 @@ int main(int argc, char** argv) args_parser.parse(argc, argv); auto file = Core::File::construct(path); if (!file->open(Core::OpenMode::ReadOnly)) { - perror("open"); + warnln("Failed to open {}: {}", path, file->error_string()); exit(1); } auto content = file->read_all();