Kaynağa Gözat

Utilities: Use File.error_string() instead of perror(3) in cpp-*

Ralf Donau 3 yıl önce
ebeveyn
işleme
60a4da8e20

+ 1 - 1
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();

+ 1 - 1
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();

+ 1 - 1
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();