1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-28 21:02:07 +00:00

LibCore+Everywhere: Move OpenMode out of IODevice

...and make it an enum class so people don't omit "OpenMode".
This commit is contained in:
Ali Mohammad Pur 2021-05-12 13:56:43 +04:30 committed by Linus Groh
parent 422ef7904e
commit a91a49337c
113 changed files with 180 additions and 177 deletions

View file

@ -879,7 +879,7 @@ void Shell::execute_process(Vector<const char*>&& argv)
}
if (saved_errno == ENOENT) {
do {
auto file_result = Core::File::open(argv[0], Core::IODevice::OpenMode::ReadOnly);
auto file_result = Core::File::open(argv[0], Core::OpenMode::ReadOnly);
if (file_result.is_error())
break;
auto& file = file_result.value();
@ -1012,7 +1012,7 @@ bool Shell::run_file(const String& filename, bool explicitly_invoked)
TemporaryChange interactive_change { m_is_interactive, false };
TemporaryChange<Optional<SourcePosition>> source_change { m_source_position, SourcePosition { .source_file = filename, .literal_source_text = {}, .position = {} } };
auto file_result = Core::File::open(filename, Core::File::ReadOnly);
auto file_result = Core::File::open(filename, Core::OpenMode::ReadOnly);
if (file_result.is_error()) {
auto error = String::formatted("'{}': {}", escape_token_for_single_quotes(filename), file_result.error());
if (explicitly_invoked)
@ -1995,7 +1995,7 @@ void Shell::possibly_print_error() const
i64 line_to_skip_to = max(source_position.position->start_line.line_number, 2ul) - 2;
if (!source_position.source_file.is_null()) {
auto file = Core::File::open(source_position.source_file, Core::IODevice::OpenMode::ReadOnly);
auto file = Core::File::open(source_position.source_file, Core::OpenMode::ReadOnly);
if (file.is_error()) {
warnln("Shell: Internal error while trying to display source information: {} (while reading '{}')", file.error(), source_position.source_file);
return;