diff options
author | Andreas Kling <kling@serenityos.org> | 2021-04-29 21:46:15 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-04-29 22:16:18 +0200 |
commit | 7ae7170d6140f7cad730f05f84b53437058b82f4 (patch) | |
tree | 79caaefa15a1e4ae1c60def7a40425983206c281 | |
parent | def1f1444aeee2caf6d47d0eb96a18ffc476c3f9 (diff) | |
download | serenity-7ae7170d6140f7cad730f05f84b53437058b82f4.zip |
Everywhere: "file name" => "filename"
59 files changed, 181 insertions, 181 deletions
diff --git a/AK/SourceLocation.h b/AK/SourceLocation.h index 54bd62fdcf..8e1a2a5dcb 100644 --- a/AK/SourceLocation.h +++ b/AK/SourceLocation.h @@ -16,7 +16,7 @@ namespace AK { class SourceLocation { public: [[nodiscard]] constexpr StringView function_name() const { return StringView(m_function); } - [[nodiscard]] constexpr StringView file_name() const { return StringView(m_file); } + [[nodiscard]] constexpr StringView filename() const { return StringView(m_file); } [[nodiscard]] constexpr u32 line_number() const { return m_line; } [[nodiscard]] static constexpr SourceLocation current(const char* const file = __builtin_FILE(), u32 line = __builtin_LINE(), const char* const function = __builtin_FUNCTION()) @@ -45,7 +45,7 @@ template<> struct AK::Formatter<AK::SourceLocation> : AK::Formatter<FormatString> { void format(FormatBuilder& builder, AK::SourceLocation location) { - return AK::Formatter<FormatString>::format(builder, "[{} @ {}:{}]", location.function_name(), location.file_name(), location.line_number()); + return AK::Formatter<FormatString>::format(builder, "[{} @ {}:{}]", location.function_name(), location.filename(), location.line_number()); } }; diff --git a/AK/Tests/TestSourceLocation.cpp b/AK/Tests/TestSourceLocation.cpp index 15910062f3..d770751d1d 100644 --- a/AK/Tests/TestSourceLocation.cpp +++ b/AK/Tests/TestSourceLocation.cpp @@ -13,7 +13,7 @@ TEST_CASE(basic_scenario) { auto location = SourceLocation::current(); - EXPECT_EQ(StringView(__FILE__), location.file_name()); + EXPECT_EQ(StringView(__FILE__), location.filename()); EXPECT_EQ(StringView(__FUNCTION__), location.function_name()); EXPECT_EQ(__LINE__ - 3u, location.line_number()); } diff --git a/Kernel/FileSystem/ext2_fs.h b/Kernel/FileSystem/ext2_fs.h index 6211a48545..2782845cee 100644 --- a/Kernel/FileSystem/ext2_fs.h +++ b/Kernel/FileSystem/ext2_fs.h @@ -664,7 +664,7 @@ struct ext2_dir_entry { __u32 inode; /* Inode number */ __u16 rec_len; /* Directory entry length */ __u16 name_len; /* Name length */ - char name[EXT2_NAME_LEN]; /* File name */ + char name[EXT2_NAME_LEN]; /* Filename */ }; /* @@ -678,7 +678,7 @@ struct ext2_dir_entry_2 { __u16 rec_len; /* Directory entry length */ __u8 name_len; /* Name length */ __u8 file_type; - char name[EXT2_NAME_LEN]; /* File name */ + char name[EXT2_NAME_LEN]; /* Filename */ }; /* diff --git a/Kernel/Thread.cpp b/Kernel/Thread.cpp index 9a80a6167b..c1cc4711ab 100644 --- a/Kernel/Thread.cpp +++ b/Kernel/Thread.cpp @@ -362,7 +362,7 @@ void Thread::finalize() ScopedSpinLock list_lock(m_holding_locks_lock); for (auto& info : m_holding_locks_list) { const auto& location = info.source_location; - dbgln(" - Lock: \"{}\" @ {} locked in function \"{}\" at \"{}:{}\" with a count of: {}", info.lock->name(), info.lock, location.function_name(), location.file_name(), location.line_number(), info.count); + dbgln(" - Lock: \"{}\" @ {} locked in function \"{}\" at \"{}:{}\" with a count of: {}", info.lock->name(), info.lock, location.function_name(), location.filename(), location.line_number(), info.count); } VERIFY_NOT_REACHED(); } diff --git a/Meta/lint-keymaps.py b/Meta/lint-keymaps.py index a22258c0ce..162db78276 100755 --- a/Meta/lint-keymaps.py +++ b/Meta/lint-keymaps.py @@ -15,7 +15,7 @@ def report(filename, problem): """Print a lint problem to stdout. Args: - filename (str): keymap file name + filename (str): keymap filename problem (str): problem message """ print('{}: {}'.format(filename, problem)) @@ -25,7 +25,7 @@ def validate_single_map(filename, mapname, values): """Validate a key map. Args: - filename (str): keymap file name + filename (str): keymap filename mapname (str): map name (altgr_map, alt_map, shift_altgr_map) values (list): key values @@ -63,7 +63,7 @@ def validate_fullmap(filename, fullmap): """Validate a full key map for all map names (including maps for key modifiers). Args: - filename (str): keymap file name + filename (str): keymap filename fullmap (dict): key mappings Returns: @@ -126,7 +126,7 @@ def list_files_here(): """Retrieve a list of all '.json' files in the working directory. Returns: - list: JSON file names + list: JSON filenames """ filelist = [] diff --git a/Meta/lint-ports.py b/Meta/lint-ports.py index 32f4382cd0..be2aa83544 100755 --- a/Meta/lint-ports.py +++ b/Meta/lint-ports.py @@ -31,7 +31,7 @@ def read_port_table(filename): """Open a file and find all PORT_TABLE_REGEX matches. Args: - filename (str): file name + filename (str): filename Returns: set: all PORT_TABLE_REGEX matches diff --git a/Userland/Applications/Debugger/main.cpp b/Userland/Applications/Debugger/main.cpp index 1d4e3469eb..0f4976d0f9 100644 --- a/Userland/Applications/Debugger/main.cpp +++ b/Userland/Applications/Debugger/main.cpp @@ -90,7 +90,7 @@ static bool insert_breakpoint_at_source_position(const String& file, size_t line warnln("Could not insert breakpoint at {}:{}", file, line); return false; } - outln("Breakpoint inserted [{}:{} ({}:{:p})]", result.value().file_name, result.value().line_number, result.value().library_name, result.value().address); + outln("Breakpoint inserted [{}:{} ({}:{:p})]", result.value().filename, result.value().line_number, result.value().library_name, result.value().address); return true; } diff --git a/Userland/Applications/FileManager/FileOperationProgressWidget.cpp b/Userland/Applications/FileManager/FileOperationProgressWidget.cpp index 0f6b84a8aa..8098c98f52 100644 --- a/Userland/Applications/FileManager/FileOperationProgressWidget.cpp +++ b/Userland/Applications/FileManager/FileOperationProgressWidget.cpp @@ -134,14 +134,14 @@ String FileOperationProgressWidget::estimate_time(off_t bytes_done, off_t total_ return String::formatted("{} hours and {} minutes", hours_remaining, minutes_remaining); } -void FileOperationProgressWidget::did_progress(off_t bytes_done, off_t total_byte_count, size_t files_done, size_t total_file_count, [[maybe_unused]] off_t current_file_done, [[maybe_unused]] off_t current_file_size, const StringView& current_file_name) +void FileOperationProgressWidget::did_progress(off_t bytes_done, off_t total_byte_count, size_t files_done, size_t total_file_count, [[maybe_unused]] off_t current_file_done, [[maybe_unused]] off_t current_file_size, const StringView& current_filename) { auto& files_copied_label = *find_descendant_of_type_named<GUI::Label>("files_copied_label"); auto& current_file_label = *find_descendant_of_type_named<GUI::Label>("current_file_label"); auto& overall_progressbar = *find_descendant_of_type_named<GUI::Progressbar>("overall_progressbar"); auto& estimated_time_label = *find_descendant_of_type_named<GUI::Label>("estimated_time_label"); - current_file_label.set_text(current_file_name); + current_file_label.set_text(current_filename); files_copied_label.set_text(String::formatted("Copying file {} of {}", files_done, total_file_count)); estimated_time_label.set_text(estimate_time(bytes_done, total_byte_count)); diff --git a/Userland/Applications/FileManager/FileOperationProgressWidget.h b/Userland/Applications/FileManager/FileOperationProgressWidget.h index 7a55f5833b..6f9b692334 100644 --- a/Userland/Applications/FileManager/FileOperationProgressWidget.h +++ b/Userland/Applications/FileManager/FileOperationProgressWidget.h @@ -22,7 +22,7 @@ private: void did_finish(); void did_error(String message); - void did_progress(off_t bytes_done, off_t total_byte_count, size_t files_done, size_t total_file_count, off_t current_file_done, off_t current_file_size, const StringView& current_file_name); + void did_progress(off_t bytes_done, off_t total_byte_count, size_t files_done, size_t total_file_count, off_t current_file_done, off_t current_file_size, const StringView& current_filename); void close_pipe(); diff --git a/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.cpp b/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.cpp index d85e5c5963..6f72a18e43 100644 --- a/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.cpp +++ b/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.cpp @@ -123,12 +123,12 @@ void KeyboardMapperWidget::create_frame() bottom_widget.layout()->add_spacer(); } -void KeyboardMapperWidget::load_from_file(String file_name) +void KeyboardMapperWidget::load_from_file(String filename) { - auto result = Keyboard::CharacterMapFile::load_from_file(file_name); + auto result = Keyboard::CharacterMapFile::load_from_file(filename); VERIFY(result.has_value()); - m_file_name = file_name; + m_filename = filename; m_character_map = result.value(); set_current_map("map"); @@ -145,7 +145,7 @@ void KeyboardMapperWidget::load_from_system() auto result = Keyboard::CharacterMap::fetch_system_map(); VERIFY(!result.is_error()); - m_file_name = String::formatted("/res/keymaps/{}.json", result.value().character_map_name()); + m_filename = String::formatted("/res/keymaps/{}.json", result.value().character_map_name()); m_character_map = result.value().character_map_data(); set_current_map("map"); @@ -159,10 +159,10 @@ void KeyboardMapperWidget::load_from_system() void KeyboardMapperWidget::save() { - save_to_file(m_file_name); + save_to_file(m_filename); } -void KeyboardMapperWidget::save_to_file(const StringView& file_name) +void KeyboardMapperWidget::save_to_file(const StringView& filename) { JsonObject map_json; @@ -188,12 +188,12 @@ void KeyboardMapperWidget::save_to_file(const StringView& file_name) // Write to file. String file_content = map_json.to_string(); - auto file = Core::File::construct(file_name); + auto file = Core::File::construct(filename); file->open(Core::IODevice::WriteOnly); if (!file->is_open()) { StringBuilder sb; sb.append("Failed to open "); - sb.append(file_name); + sb.append(filename); sb.append(" for write. Error: "); sb.append(file->error_string()); @@ -213,7 +213,7 @@ void KeyboardMapperWidget::save_to_file(const StringView& file_name) } m_modified = false; - m_file_name = file_name; + m_filename = filename; update_window_title(); } @@ -274,7 +274,7 @@ void KeyboardMapperWidget::set_current_map(const String current_map) void KeyboardMapperWidget::update_window_title() { StringBuilder sb; - sb.append(m_file_name); + sb.append(m_filename); if (m_modified) sb.append(" (*)"); sb.append(" - KeyboardMapper"); diff --git a/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.h b/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.h index cdff3cc074..1c11dc17ca 100644 --- a/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.h +++ b/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.h @@ -34,7 +34,7 @@ private: Vector<KeyButton*> m_keys; RefPtr<GUI::Widget> m_map_group; - String m_file_name; + String m_filename; Keyboard::CharacterMapData m_character_map; String m_current_map_name; bool m_modified { false }; diff --git a/Userland/Applications/KeyboardSettings/CharacterMapFileListModel.h b/Userland/Applications/KeyboardSettings/CharacterMapFileListModel.h index d0585e1c46..2dc6f3df04 100644 --- a/Userland/Applications/KeyboardSettings/CharacterMapFileListModel.h +++ b/Userland/Applications/KeyboardSettings/CharacterMapFileListModel.h @@ -11,16 +11,16 @@ class CharacterMapFileListModel final : public GUI::Model { public: - static NonnullRefPtr<CharacterMapFileListModel> create(Vector<String>& file_names) + static NonnullRefPtr<CharacterMapFileListModel> create(Vector<String>& filenames) { - return adopt_ref(*new CharacterMapFileListModel(file_names)); + return adopt_ref(*new CharacterMapFileListModel(filenames)); } virtual ~CharacterMapFileListModel() override { } virtual int row_count(const GUI::ModelIndex&) const override { - return m_file_names.size(); + return m_filenames.size(); } virtual int column_count(const GUI::ModelIndex&) const override @@ -34,7 +34,7 @@ public: VERIFY(index.column() == 0); if (role == GUI::ModelRole::Display) - return m_file_names.at(index.row()); + return m_filenames.at(index.row()); return {}; } @@ -45,10 +45,10 @@ public: } private: - explicit CharacterMapFileListModel(Vector<String>& file_names) - : m_file_names(file_names) + explicit CharacterMapFileListModel(Vector<String>& filenames) + : m_filenames(filenames) { } - Vector<String>& m_file_names; + Vector<String>& m_filenames; }; diff --git a/Userland/Applications/Terminal/main.cpp b/Userland/Applications/Terminal/main.cpp index 8f733ecdcf..71b0cc81da 100644 --- a/Userland/Applications/Terminal/main.cpp +++ b/Userland/Applications/Terminal/main.cpp @@ -329,7 +329,7 @@ int main(int argc, char** argv) } RefPtr<Core::ConfigFile> config = Core::ConfigFile::get_for_app("Terminal"); - Core::File::ensure_parent_directories(config->file_name()); + Core::File::ensure_parent_directories(config->filename()); pid_t shell_pid = 0; @@ -485,7 +485,7 @@ int main(int argc, char** argv) return 1; } - if (unveil(config->file_name().characters(), "rwc") < 0) { + if (unveil(config->filename().characters(), "rwc") < 0) { perror("unveil"); return 1; } diff --git a/Userland/DevTools/HackStudio/HackStudioWidget.cpp b/Userland/DevTools/HackStudio/HackStudioWidget.cpp index eacb469d63..0fafe27a98 100644 --- a/Userland/DevTools/HackStudio/HackStudioWidget.cpp +++ b/Userland/DevTools/HackStudio/HackStudioWidget.cpp @@ -675,14 +675,14 @@ String HackStudioWidget::get_full_path_of_serenity_source(const String& file) return String::formatted("{}/{}", serenity_sources_base, relative_path_builder.to_string()); } -RefPtr<EditorWrapper> HackStudioWidget::get_editor_of_file(const String& file_name) +RefPtr<EditorWrapper> HackStudioWidget::get_editor_of_file(const String& filename) { - String file_path = file_name; + String file_path = filename; // TODO: We can probably do a more specific condition here, something like // "if (file.starts_with("../Libraries/") || file.starts_with("../AK/"))" - if (file_name.starts_with("../")) { - file_path = get_full_path_of_serenity_source(file_name); + if (filename.starts_with("../")) { + file_path = get_full_path_of_serenity_source(filename); } if (!open_file(file_path)) diff --git a/Userland/DevTools/HackStudio/HackStudioWidget.h b/Userland/DevTools/HackStudio/HackStudioWidget.h index c3104a66e8..9cf5e8b6d6 100644 --- a/Userland/DevTools/HackStudio/HackStudioWidget.h +++ b/Userland/DevTools/HackStudio/HackStudioWidget.h @@ -86,7 +86,7 @@ private: NonnullRefPtr<GUI::Action> create_set_autocomplete_mode_action(); void add_new_editor(GUI::Widget& parent); - RefPtr<EditorWrapper> get_editor_of_file(const String& file_name); + RefPtr<EditorWrapper> get_editor_of_file(const String& filename); String get_project_executable_path() const; void on_action_tab_change(); diff --git a/Userland/DevTools/HackStudio/LanguageServers/ClientConnection.cpp b/Userland/DevTools/HackStudio/LanguageServers/ClientConnection.cpp index 601ecf307a..6346f865e3 100644 --- a/Userland/DevTools/HackStudio/LanguageServers/ClientConnection.cpp +++ b/Userland/DevTools/HackStudio/LanguageServers/ClientConnection.cpp @@ -46,28 +46,28 @@ OwnPtr<Messages::LanguageServer::GreetResponse> ClientConnection::handle(const M void ClientConnection::handle(const Messages::LanguageServer::FileOpened& message) { - if (m_filedb.is_open(message.file_name())) { + if (m_filedb.is_open(message.filename())) { return; } - m_filedb.add(message.file_name(), message.file().take_fd()); - m_autocomplete_engine->file_opened(message.file_name()); + m_filedb.add(message.filename(), message.file().take_fd()); + m_autocomplete_engine->file_opened(message.filename()); } void ClientConnection::handle(const Messages::LanguageServer::FileEditInsertText& message) { - dbgln_if(LANGUAGE_SERVER_DEBUG, "InsertText for file: {}", message.file_name()); + dbgln_if(LANGUAGE_SERVER_DEBUG, "InsertText for file: {}", message.filename()); dbgln_if(LANGUAGE_SERVER_DEBUG, "Text: {}", message.text()); dbgln_if(LANGUAGE_SERVER_DEBUG, "[{}:{}]", message.start_line(), message.start_column()); - m_filedb.on_file_edit_insert_text(message.file_name(), message.text(), message.start_line(), message.start_column()); - m_autocomplete_engine->on_edit(message.file_name()); + m_filedb.on_file_edit_insert_text(message.filename(), message.text(), message.start_line(), message.start_column()); + m_autocomplete_engine->on_edit(message.filename()); } void ClientConnection::handle(const Messages::LanguageServer::FileEditRemoveText& message) { - dbgln_if(LANGUAGE_SERVER_DEBUG, "RemoveText for file: {}", message.file_name()); + dbgln_if(LANGUAGE_SERVER_DEBUG, "RemoveText for file: {}", message.filename()); dbgln_if(LANGUAGE_SERVER_DEBUG, "[{}:{} - {}:{}]", message.start_line(), message.start_column(), message.end_line(), message.end_column()); - m_filedb.on_file_edit_remove_text(message.file_name(), message.start_line(), message.start_column(), message.end_line(), message.end_column()); - m_autocomplete_engine->on_edit(message.file_name()); + m_filedb.on_file_edit_remove_text(message.filename(), message.start_line(), message.start_column(), message.end_line(), message.end_column()); + m_autocomplete_engine->on_edit(message.filename()); } void ClientConnection::handle(const Messages::LanguageServer::AutoCompleteSuggestions& message) @@ -87,17 +87,17 @@ void ClientConnection::handle(const Messages::LanguageServer::AutoCompleteSugges void ClientConnection::handle(const Messages::LanguageServer::SetFileContent& message) { - dbgln_if(LANGUAGE_SERVER_DEBUG, "SetFileContent: {}", message.file_name()); - auto document = m_filedb.get(message.file_name()); + dbgln_if(LANGUAGE_SERVER_DEBUG, "SetFileContent: {}", message.filename()); + auto document = m_filedb.get(message.filename()); if (!document) { - m_filedb.add(message.file_name(), message.content()); - VERIFY(m_filedb.is_open(message.file_name())); + m_filedb.add(message.filename(), message.content()); + VERIFY(m_filedb.is_open(message.filename())); } else { const auto& content = message.content(); document->set_text(content.view()); } - VERIFY(m_filedb.is_open(message.file_name())); - m_autocomplete_engine->on_edit(message.file_name()); + VERIFY(m_filedb.is_open(message.filename())); + m_autocomplete_engine->on_edit(message.filename()); } void ClientConnection::handle(const Messages::LanguageServer::FindDeclaration& message) diff --git a/Userland/DevTools/HackStudio/LanguageServers/Cpp/ParserAutoComplete.cpp b/Userland/DevTools/HackStudio/LanguageServers/Cpp/ParserAutoComplete.cpp index 29018894ad..cb5957e121 100644 --- a/Userland/DevTools/HackStudio/LanguageServers/Cpp/ParserAutoComplete.cpp +++ b/Userland/DevTools/HackStudio/LanguageServers/Cpp/ParserAutoComplete.cpp @@ -337,9 +337,9 @@ void ParserAutoComplete::file_opened([[maybe_unused]] const String& file) set_document_data(file, create_document_data_for(file)); } -Optional<GUI::AutocompleteProvider::ProjectLocation> ParserAutoComplete::find_declaration_of(const String& file_name, const GUI::TextPosition& identifier_position) +Optional<GUI::AutocompleteProvider::ProjectLocation> ParserAutoComplete::find_declaration_of(const String& filename, const GUI::TextPosition& identifier_position) { - const auto* document_ptr = get_or_create_document_data(file_name); + const auto* document_ptr = get_or_create_document_data(filename); if (!document_ptr) return {}; diff --git a/Userland/DevTools/HackStudio/LanguageServers/Cpp/ParserAutoComplete.h b/Userland/DevTools/HackStudio/LanguageServers/Cpp/ParserAutoComplete.h index f1e8a103f7..5d8c4487db 100644 --- a/Userland/DevTools/HackStudio/LanguageServers/Cpp/ParserAutoComplete.h +++ b/Userland/DevTools/HackStudio/LanguageServers/Cpp/ParserAutoComplete.h @@ -28,7 +28,7 @@ public: virtual Vector<GUI::AutocompleteProvider::Entry> get_suggestions(const String& file, const GUI::TextPosition& autocomplete_position) override; virtual void on_edit(const String& file) override; virtual void file_opened([[maybe_unused]] const String& file) override; - virtual Optional<GUI::AutocompleteProvider::ProjectLocation> find_declaration_of(const String& file_name, const GUI::TextPosition& identifier_position) override; + virtual Optional<GUI::AutocompleteProvider::ProjectLocation> find_declaration_of(const String& filename, const GUI::TextPosition& identifier_position) override; private: struct DocumentData { diff --git a/Userland/DevTools/HackStudio/LanguageServers/FileDB.cpp b/Userland/DevTools/HackStudio/LanguageServers/FileDB.cpp index 0dc64cb6a3..13f14959fe 100644 --- a/Userland/DevTools/HackStudio/LanguageServers/FileDB.cpp +++ b/Userland/DevTools/HackStudio/LanguageServers/FileDB.cpp @@ -11,9 +11,9 @@ namespace LanguageServers { -RefPtr<const GUI::TextDocument> FileDB::get(const String& file_name) const +RefPtr<const GUI::TextDocument> FileDB::get(const String& filename) const { - auto absolute_path = to_absolute_path(file_name); + auto absolute_path = to_absolute_path(filename); auto document_optional = m_open_files.get(absolute_path); if (!document_optional.has_value()) return nullptr; @@ -21,60 +21,60 @@ RefPtr<const GUI::TextDocument> FileDB::get(const String& file_name) const return document_optional.value(); } -RefPtr<GUI::TextDocument> FileDB::get(const String& file_name) +RefPtr<GUI::TextDocument> FileDB::get(const String& filename) { - auto document = reinterpret_cast<const FileDB*>(this)->get(file_name); + auto document = reinterpret_cast<const FileDB*>(this)->get(filename); if (document.is_null()) return nullptr; return adopt_ref(*const_cast<GUI::TextDocument*>(document.leak_ref())); } -RefPtr<const GUI::TextDocument> FileDB::get_or_create_from_filesystem(const String& file_name) const +RefPtr<const GUI::TextDocument> FileDB::get_or_create_from_filesystem(const String& filename) const { - auto absolute_path = to_absolute_path(file_name); + auto absolute_path = to_absolute_path(filename); auto document = get(absolute_path); if (document) return document; return create_from_filesystem(absolute_path); } -RefPtr<GUI::TextDocument> FileDB::get_or_create_from_filesystem(const String& file_name) +RefPtr<GUI::TextDocument> FileDB::get_or_create_from_filesystem(const String& filename) { - auto document = reinterpret_cast<const FileDB*>(this)->get_or_create_from_filesystem(file_name); + auto document = reinterpret_cast<const FileDB*>(this)->get_or_create_from_filesystem(filename); if (document.is_null()) return nullptr; return adopt_ref(*const_cast<GUI::TextDocument*>(document.leak_ref())); } -bool FileDB::is_open(const String& file_name) const +bool FileDB::is_open(const String& filename) const { - return m_open_files.contains(to_absolute_path(file_name)); + return m_open_files.contains(to_absolute_path(filename)); } -bool FileDB::add(const String& file_name, int fd) +bool FileDB::add(const String& filename, int fd) { auto document = create_from_fd(fd); if (!document) return false; - m_open_files.set(to_absolute_path(file_name), document.release_nonnull()); + m_open_files.set(to_absolute_path(filename), document.release_nonnull()); return true; } -String FileDB::to_absolute_path(const String& file_name) const +String FileDB::to_absolute_path(const String& filename) const { - if (LexicalPath { file_name }.is_absolute()) { - return file_name; + if (LexicalPath { filename }.is_absolute()) { + return filename; } VERIFY(!m_project_root.is_null()); - return LexicalPath { String::formatted("{}/{}", m_project_root, file_name) }.string(); + return LexicalPath { String::formatted("{}/{}", m_project_root, filename) }.string(); } -RefPtr<GUI::TextDocument> FileDB::create_from_filesystem(const String& file_name) const +RefPtr<GUI::TextDocument> FileDB::create_from_filesystem(const String& filename) const { - auto file = Core::File::open(to_absolute_path(file_name), Core::IODevice::ReadOnly); + auto file = Core::File::open(to_absolute_path(filename), Core::IODevice::ReadOnly); if (file.is_error()) { - dbgln("failed to create document for {} from filesystem", file_name); + dbgln("failed to create document for {} from filesystem", filename); return nullptr; } return create_from_file(*file.value()); @@ -117,10 +117,10 @@ RefPtr<GUI::TextDocument> FileDB::create_from_file(Core::File& file) const return document; } -void FileDB::on_file_edit_insert_text(const String& file_name, const String& inserted_text, size_t start_line, size_t start_column) +void FileDB::on_file_edit_insert_text(const String& filename, const String& inserted_text, size_t start_line, size_t start_column) { - VERIFY(is_open(file_name)); - auto document = get(file_name); + VERIFY(is_open(filename)); + auto document = get(filename); VERIFY(document); GUI::TextPosition start_position { start_line, start_column }; document->insert_at(start_position, inserted_text, &s_default_document_client); @@ -128,12 +128,12 @@ void FileDB::on_file_edit_insert_text(const String& file_name, const String& ins dbgln_if(FILE_CONTENT_DEBUG, "{}", document->text()); } -void FileDB::on_file_edit_remove_text(const String& file_name, size_t start_line, size_t start_column, size_t end_line, size_t end_column) +void FileDB::on_file_edit_remove_text(const String& filename, size_t start_line, size_t start_column, size_t end_line, size_t end_column) { // TODO: If file is not open - need to get its contents // Otherwise- somehow verify that respawned language server is synced with all file contents - VERIFY(is_open(file_name)); - auto document = get(file_name); + VERIFY(is_open(filename)); + auto document = get(filename); VERIFY(document); GUI::TextPosition start_position { start_line, start_column }; GUI::TextRange range { @@ -153,7 +153,7 @@ RefPtr<GUI::TextDocument> FileDB::create_with_content(const String& content) return document; } -bool FileDB::add(const String& file_name, const String& content) +bool FileDB::add(const String& filename, const String& content) { auto document = create_with_content(content); if (!document) { @@ -161,7 +161,7 @@ bool FileDB::add(const String& file_name, const String& content) return false; } - m_open_files.set(to_absolute_path(file_name), document.release_nonnull()); + m_open_files.set(to_absolute_path(filename), document.release_nonnull()); return true; } diff --git a/Userland/DevTools/HackStudio/LanguageServers/FileDB.h b/Userland/DevTools/HackStudio/LanguageServers/FileDB.h index 8c0b6733a1..c3eda1b461 100644 --- a/Userland/DevTools/HackStudio/LanguageServers/FileDB.h +++ b/Userland/DevTools/HackStudio/LanguageServers/FileDB.h @@ -15,22 +15,22 @@ namespace LanguageServers { class FileDB final { public: - RefPtr<const GUI::TextDocument> get(const String& file_name) const; - RefPtr<GUI::TextDocument> get(const String& file_name); - RefPtr<const GUI::TextDocument> get_or_create_from_filesystem(const String& file_name) const; - RefPtr<GUI::TextDocument> get_or_create_from_filesystem(const String& file_name); - bool add(const String& file_name, int fd); - bool add(const String& file_name, const String& content); + RefPtr<const GUI::TextDocument> get(const String& filename) const; + RefPtr<GUI::TextDocument> get(const String& filename); + RefPtr<const GUI::TextDocument> get_or_create_from_filesystem(const String& filename) const; + RefPtr<GUI::TextDocument> get_or_create_from_filesystem(const String& filename); + bool add(const String& filename, int fd); + bool add(const String& filename, const String& content); void set_project_root(const String& root_path) { m_project_root = root_path; } - void on_file_edit_insert_text(const String& file_name, const String& inserted_text, size_t start_line, size_t start_column); - void on_file_edit_remove_text(const String& file_name, size_t start_line, size_t start_column, size_t end_line, size_t end_column); - String to_absolute_path(const String& file_name) const; - bool is_open(const String& file_name) const; + void on_file_edit_insert_text(const String& filename, const String& inserted_text, size_t start_line, size_t start_column); + void on_file_edit_remove_text(const String& filename, size_t start_line, size_t start_column, size_t end_line, size_t end_column); + String to_absolute_path(const String& filename) const; + bool is_open(const String& filename) const; private: - RefPtr<GUI::TextDocument> create_from_filesystem(const String& file_name) const; + RefPtr<GUI::TextDocument> create_from_filesystem(const String& filename) const; RefPtr<GUI::TextDocument> create_from_fd(int fd) const; RefPtr<GUI::TextDocument> create_from_file(Core::File&) const; static RefPtr<GUI::TextDocument> create_with_content(const String&); diff --git a/Userland/DevTools/HackStudio/LanguageServers/LanguageServer.ipc b/Userland/DevTools/HackStudio/LanguageServers/LanguageServer.ipc index 938d616be2..ea3b3b416e 100644 --- a/Userland/DevTools/HackStudio/LanguageServers/LanguageServer.ipc +++ b/Userland/DevTools/HackStudio/LanguageServers/LanguageServer.ipc @@ -2,10 +2,10 @@ endpoint LanguageServer { Greet(String project_root) => () - FileOpened(String file_name, IPC::File file) =| - FileEditInsertText(String file_name, String text, i32 start_line, i32 start_column) =| - FileEditRemoveText(String file_name, i32 start_line, i32 start_column, i32 end_line, i32 end_column) =| - SetFileContent(String file_name, String content) =| + FileOpened(String filename, IPC::File file) =| + FileEditInsertText(String filename, String text, i32 start_line, i32 start_column) =| + FileEditRemoveText(String filename, i32 start_line, i32 start_column, i32 end_line, i32 end_column) =| + SetFileContent(String filename, String content) =| AutoCompleteSuggestions(GUI::AutocompleteProvider::ProjectLocation location) =| SetAutoCompleteMode(String mode) =| diff --git a/Userland/DevTools/HackStudio/LanguageServers/Shell/AutoComplete.cpp b/Userland/DevTools/HackStudio/LanguageServers/Shell/AutoComplete.cpp index fc00931fa8..81182db506 100644 --- a/Userland/DevTools/HackStudio/LanguageServers/Shell/AutoComplete.cpp +++ b/Userland/DevTools/HackStudio/LanguageServers/Shell/AutoComplete.cpp @@ -164,10 +164,10 @@ void AutoComplete::file_opened([[maybe_unused]] const String& file) set_document_data(file, create_document_data_for(file)); } -Optional<GUI::AutocompleteProvider::ProjectLocation> AutoComplete::find_declaration_of(const String& file_name, const GUI::TextPosition& identifier_position) +Optional<GUI::AutocompleteProvider::ProjectLocation> AutoComplete::find_declaration_of(const String& filename, const GUI::TextPosition& identifier_position) { - dbgln_if(SH_LANGUAGE_SERVER_DEBUG, "find_declaration_of({}, {}:{})", file_name, identifier_position.line(), identifier_position.column()); - const auto& document = get_or_create_document_data(file_name); + dbgln_if(SH_LANGUAGE_SERVER_DEBUG, "find_declaration_of({}, {}:{})", filename, identifier_position.line(), identifier_position.column()); + const auto& document = get_or_create_document_data(filename); auto position = resolve(document, identifier_position); auto result = document.node->hit_test_position(position); if (!result.matching_node) { diff --git a/Userland/DevTools/HackStudio/LanguageServers/Shell/AutoComplete.h b/Userland/DevTools/HackStudio/LanguageServers/Shell/AutoComplete.h index de1d3f9d70..2bfdf0aced 100644 --- a/Userland/DevTools/HackStudio/LanguageServers/Shell/AutoComplete.h +++ b/Userland/DevTools/HackStudio/LanguageServers/Shell/AutoComplete.h @@ -17,7 +17,7 @@ public: virtual Vector<GUI::AutocompleteProvider::Entry> get_suggestions(const String& file, const GUI::TextPosition& position) override; virtual void on_edit(const String& file) override; virtual void file_opened([[maybe_unused]] const String& file) override; - virtual Optional<GUI::AutocompleteProvider::ProjectLocation> find_declaration_of(const String& file_name, const GUI::TextPosition& identifier_position) override; + virtual Optional<GUI::AutocompleteProvider::ProjectLocation> find_declaration_of(const String& filename, const GUI::TextPosition& identifier_position) override; private: struct DocumentData { diff --git a/Userland/DevTools/HackStudio/main.cpp b/Userland/DevTools/HackStudio/main.cpp index 4b9c7013cb..547d69ad7a 100644 --- a/Userland/DevTools/HackStudio/main.cpp +++ b/Userland/DevTools/HackStudio/main.cpp @@ -132,14 +132,14 @@ GUI::TextEditor& current_editor() return s_hack_studio_widget->current_editor(); } -void open_file(const String& file_name) +void open_file(const String& filename) { - s_hack_studio_widget->open_file(file_name); + s_hack_studio_widget->open_file(filename); } -void open_file(const String& file_name, size_t line, size_t column) +void open_file(const String& filename, size_t line, size_t column) { - s_hack_studio_widget->open_file(file_name); + s_hack_studio_widget->open_file(filename); s_hack_studio_widget->current_editor_wrapper().editor().set_cursor({ line, column }); } diff --git a/Userland/Games/2048/main.cpp b/Userland/Games/2048/main.cpp index 99054b1470..4c12afe699 100644 --- a/Userland/Games/2048/main.cpp +++ b/Userland/Games/2048/main.cpp @@ -56,7 +56,7 @@ int main(int argc, char** argv) return 1; } - if (unveil(config->file_name().characters(), "crw") < 0) { + if (unveil(config->filename().characters(), "crw") < 0) { perror("unveil"); return 1; } diff --git a/Userland/Games/Chess/main.cpp b/Userland/Games/Chess/main.cpp index 928d7990f3..4747a14996 100644 --- a/Userland/Games/Chess/main.cpp +++ b/Userland/Games/Chess/main.cpp @@ -38,7 +38,7 @@ int main(int argc, char** argv) return 1; } - if (unveil(config->file_name().characters(), "crw") < 0) { + if (unveil(config->filename().characters(), "crw") < 0) { perror("unveil"); return 1; } diff --git a/Userland/Games/Minesweeper/main.cpp b/Userland/Games/Minesweeper/main.cpp index 424adf59cb..c6a1d1994a 100644 --- a/Userland/Games/Minesweeper/main.cpp +++ b/Userland/Games/Minesweeper/main.cpp @@ -40,7 +40,7 @@ int main(int argc, char** argv) return 1; } - if (unveil(config->file_name().characters(), "crw") < 0) { + if (unveil(config->filename().characters(), "crw") < 0) { perror("unveil"); return 1; } diff --git a/Userland/Games/Pong/main.cpp b/Userland/Games/Pong/main.cpp index d7cce5901e..6451b5d3ec 100644 --- a/Userland/Games/Pong/main.cpp +++ b/Userland/Games/Pong/main.cpp @@ -35,7 +35,7 @@ int main(int argc, char** argv) return 1; } - if (unveil(config->file_name().characters(), "rwc") < 0) { + if (unveil(config->filename().characters(), "rwc") < 0) { perror("unveil"); return 1; } diff --git a/Userland/Games/Snake/main.cpp b/Userland/Games/Snake/main.cpp index 13674ea302..ae10a8b7a1 100644 --- a/Userland/Games/Snake/main.cpp +++ b/Userland/Games/Snake/main.cpp @@ -38,7 +38,7 @@ int main(int argc, char** argv) return 1; } - if (unveil(config->file_name().characters(), "crw") < 0) { + if (unveil(config->filename().characters(), "crw") < 0) { perror("unveil"); return 1; } diff --git a/Userland/Libraries/LibArchive/Tar.h b/Userland/Libraries/LibArchive/Tar.h index 4d2867193b..de3118b983 100644 --- a/Userland/Libraries/LibArchive/Tar.h +++ b/Userland/Libraries/LibArchive/Tar.h @@ -38,7 +38,7 @@ constexpr const char* posix1_tar_version = ""; // POSIX.1-1988 format version class [[gnu::packed]] TarFileHeader { public: - const StringView file_name() const { return m_file_name; } + const StringView filename() const { return m_filename; } mode_t mode() const { return get_tar_field(m_mode); } uid_t uid() const { return get_tar_field(m_uid); } gid_t gid() const { return get_tar_field(m_gid); } @@ -57,7 +57,7 @@ public: // FIXME: support ustar filename prefix const StringView prefix() const { return m_prefix; } - void set_file_name(const String& file_name) { VERIFY(file_name.copy_characters_to_buffer(m_file_name, sizeof(m_file_name))); } + void set_filename(const String& filename) { VERIFY(filename.copy_characters_to_buffer(m_filename, sizeof(m_filename))); } void set_mode(mode_t mode) { VERIFY(String::formatted("{:o}", mode).copy_characters_to_buffer(m_mode, sizeof(m_mode))); } void set_uid(uid_t uid) { VERIFY(String::formatted("{:o}", uid).copy_characters_to_buffer(m_uid, sizeof(m_uid))); } void set_gid(gid_t gid) { VERIFY(String::formatted("{:o}", gid).copy_characters_to_buffer(m_gid, sizeof(m_gid))); } @@ -77,7 +77,7 @@ public: void calculate_checksum(); private: - char m_file_name[100]; + char m_filename[100]; char m_mode[8]; char m_uid[8]; char m_gid[8]; diff --git a/Userland/Libraries/LibArchive/TarStream.cpp b/Userland/Libraries/LibArchive/TarStream.cpp index bb892fea7e..5db912b6b2 100644 --- a/Userland/Libraries/LibArchive/TarStream.cpp +++ b/Userland/Libraries/LibArchive/TarStream.cpp @@ -132,7 +132,7 @@ void TarOutputStream::add_directory(const String& path, mode_t mode) TarFileHeader header; memset(&header, 0, sizeof(header)); header.set_size(0); - header.set_file_name(String::formatted("{}/", path)); // Old tar implementations assume directory names end with a / + header.set_filename(String::formatted("{}/", path)); // Old tar implementations assume directory names end with a / header.set_type_flag(TarFileType::Directory); header.set_mode(mode); header.set_magic(gnu_magic); @@ -149,7 +149,7 @@ void TarOutputStream::add_file(const String& path, mode_t mode, const ReadonlyBy TarFileHeader header; memset(&header, 0, sizeof(header)); header.set_size(bytes.size()); - header.set_file_name(path); + header.set_filename(path); header.set_type_flag(TarFileType::NormalFile); header.set_mode(mode); header.set_magic(gnu_magic); diff --git a/Userland/Libraries/LibCore/ConfigFile.cpp b/Userland/Libraries/LibCore/ConfigFile.cpp index 7bb69df9ac..5bbf8fae21 100644 --- a/Userland/Libraries/LibCore/ConfigFile.cpp +++ b/Userland/Libraries/LibCore/ConfigFile.cpp @@ -41,8 +41,8 @@ NonnullRefPtr<ConfigFile> ConfigFile::open(const String& path) return adopt_ref(*new ConfigFile(path)); } -ConfigFile::ConfigFile(const String& file_name) - : m_file_name(file_name) +ConfigFile::ConfigFile(const String& filename) + : m_filename(filename) { reparse(); } @@ -56,7 +56,7 @@ void ConfigFile::reparse() { m_groups.clear(); - auto file = File::construct(m_file_name); + auto file = File::construct(m_filename); if (!file->open(IODevice::OpenMode::ReadOnly)) return; @@ -151,7 +151,7 @@ bool ConfigFile::sync() if (!m_dirty) return true; - FILE* fp = fopen(m_file_name.characters(), "wb"); + FILE* fp = fopen(m_filename.characters(), "wb"); if (!fp) return false; diff --git a/Userland/Libraries/LibCore/ConfigFile.h b/Userland/Libraries/LibCore/ConfigFile.h index 862cd6255d..0610f39e0c 100644 --- a/Userland/Libraries/LibCore/ConfigFile.h +++ b/Userland/Libraries/LibCore/ConfigFile.h @@ -47,14 +47,14 @@ public: void remove_group(const String& group); void remove_entry(const String& group, const String& key); - String file_name() const { return m_file_name; } + String filename() const { return m_filename; } private: - explicit ConfigFile(const String& file_name); + explicit ConfigFile(const String& filename); void reparse(); - String m_file_name; + String m_filename; HashMap<String, HashMap<String, String>> m_groups; bool m_dirty { false }; }; diff --git a/Userland/Libraries/LibDebug/DebugSession.cpp b/Userland/Libraries/LibDebug/DebugSession.cpp index 55a2c6874a..b05494705a 100644 --- a/Userland/Libraries/LibDebug/DebugSession.cpp +++ b/Userland/Libraries/LibDebug/DebugSession.cpp @@ -372,9 +372,9 @@ Optional<DebugSession::InsertBreakpointAtSymbolResult> DebugSession::insert_brea return result; } -Optional<DebugSession::InsertBreakpointAtSourcePositionResult> DebugSession::insert_breakpoint(const String& file_name, size_t line_number) +Optional<DebugSession::InsertBreakpointAtSourcePositionResult> DebugSession::insert_breakpoint(const String& filename, size_t line_number) { - auto address_and_source_position = get_address_from_source_position(file_name, line_number); + auto address_and_source_position = get_address_from_source_position(filename, line_number); if (!address_and_source_position.has_value()) return {}; diff --git a/Userland/Libraries/LibDebug/DebugSession.h b/Userland/Libraries/LibDebug/DebugSession.h index 0e9057cb3c..dac76d5387 100644 --- a/Userland/Libraries/LibDebug/DebugSession.h +++ b/Userland/Libraries/LibDebug/DebugSession.h @@ -57,12 +57,12 @@ public: struct InsertBreakpointAtSourcePositionResult { String library_name; - String file_name; + String filename; size_t line_number { 0 }; FlatPtr address { 0 }; }; - Optional<InsertBreakpointAtSourcePositionResult> insert_breakpoint(const String& file_name, size_t line_number); + Optional<InsertBreakpointAtSourcePositionResult> insert_breakpoint(const String& filename, size_t line_number); bool insert_breakpoint(void* address); bool disable_breakpoint(void* address); diff --git a/Userland/Libraries/LibDesktop/AppFile.h b/Userland/Libraries/LibDesktop/AppFile.h index 5f847ec3e6..2172601a49 100644 --- a/Userland/Libraries/LibDesktop/AppFile.h +++ b/Userland/Libraries/LibDesktop/AppFile.h @@ -21,7 +21,7 @@ public: ~AppFile(); bool is_valid() const { return m_valid; } - String file_name() const { return m_config->file_name(); } + String filename() const { return m_config->filename(); } String name() const; String executable() const; diff --git a/Userland/Libraries/LibDl/dlfcn.cpp b/Userland/Libraries/LibDl/dlfcn.cpp index cde41168d5..ef730e845d 100644 --- a/Userland/Libraries/LibDl/dlfcn.cpp +++ b/Userland/Libraries/LibDl/dlfcn.cpp @@ -41,9 +41,9 @@ char* dlerror() return const_cast<char*>(s_dlerror_text); } -void* dlopen(const char* file_name, int flags) +void* dlopen(const char* filename, int flags) { - auto result = __dlopen(file_name, flags); + auto result = __dlopen(filename, flags); if (result.is_error()) { store_error(result.error().text); return nullptr; diff --git a/Userland/Libraries/LibELF/AuxiliaryVector.h b/Userland/Libraries/LibELF/AuxiliaryVector.h index bad82fadf9..3524e9c9fb 100644 --- a/Userland/Libraries/LibELF/AuxiliaryVector.h +++ b/Userland/Libraries/LibELF/AuxiliaryVector.h @@ -42,7 +42,7 @@ typedef struct #define AT_BASE_PLATFORM 24 /* a_ptr points to a string identifying base platform name, which might be different from platform (e.g x86_64 when in i386 compat) */ #define AT_RANDOM 25 /* a_ptr points to 16 securely generated random bytes */ #define AT_HWCAP2 26 /* a_val holds extended hw feature mask. Currently 0 */ -#define AT_EXECFN 31 /* a_ptr points to file name of executed program */ +#define AT_EXECFN 31 /* a_ptr points to filename of executed program */ #define AT_EXE_BASE 32 /* a_ptr holds base address where main program was loaded into memory */ #define AT_EXE_SIZE 33 /* a_val holds the size of the main program in memory */ diff --git a/Userland/Libraries/LibGUI/Desktop.cpp b/Userland/Libraries/LibGUI/Desktop.cpp index 024a1d3cac..77d40ed2b3 100644 --- a/Userland/Libraries/LibGUI/Desktop.cpp +++ b/Userland/Libraries/LibGUI/Desktop.cpp @@ -49,7 +49,7 @@ bool Desktop::set_wallpaper(const StringView& path, bool save_config) if (ret_val && save_config) { RefPtr<Core::ConfigFile> config = Core::ConfigFile::get_for_app("WindowManager"); - dbgln("Saving wallpaper path '{}' to config file at {}", path, config->file_name()); + dbgln("Saving wallpaper path '{}' to config file at {}", path, config->filename()); config->write_entry("Background", "Wallpaper", path); config->sync(); } diff --git a/Userland/Libraries/LibGUI/FilePicker.cpp b/Userland/Libraries/LibGUI/FilePicker.cpp index 1685dcacea..0abf77d6b6 100644 --- a/Userland/Libraries/LibGUI/FilePicker.cpp +++ b/Userland/Libraries/LibGUI/FilePicker.cpp @@ -62,7 +62,7 @@ Optional<String> FilePicker::get_save_filepath(Window* parent_window, const Stri return {}; } -FilePicker::FilePicker(Window* parent_window, Mode mode, const StringView& file_name, const StringView& path) +FilePicker::FilePicker(Window* parent_window, Mode mode, const StringView& filename, const StringView& path) : Dialog(parent_window) , m_model(FileSystemModel::create()) , m_mode(mode) @@ -148,7 +148,7 @@ FilePicker::FilePicker(Window* parent_window, Mode mode, const StringView& file_ m_filename_textbox = *widget.find_descendant_of_type_named<GUI::TextBox>("filename_textbox"); m_filename_textbox->set_focus(true); if (m_mode == Mode::Save) { - m_filename_textbox->set_text(file_name); + m_filename_textbox->set_text(filename); m_filename_textbox->select_all(); } m_filename_textbox->on_return_pressed = [&] { diff --git a/Userland/Libraries/LibGUI/FilePicker.h b/Userland/Libraries/LibGUI/FilePicker.h index 595a646522..93edc34136 100644 --- a/Userland/Libraries/LibGUI/FilePicker.h +++ b/Userland/Libraries/LibGUI/FilePicker.h @@ -43,7 +43,7 @@ private: // ^GUI::ModelClient virtual void model_did_update(unsigned) override; - FilePicker(Window* parent_window, Mode type = Mode::Open, const StringView& file_name = "Untitled", const StringView& path = Core::StandardPaths::home_directory()); + FilePicker(Window* parent_window, Mode type = Mode::Open, const StringView& filename = "Untitled", const StringView& path = Core::StandardPaths::home_directory()); static String ok_button_name(Mode mode) { diff --git a/Userland/Libraries/LibGUI/FilePickerDialog.gml b/Userland/Libraries/LibGUI/FilePickerDialog.gml index 6bac8140cc..cd291fac5b 100644 --- a/Userland/Libraries/LibGUI/FilePickerDialog.gml +++ b/Userland/Libraries/LibGUI/FilePickerDialog.gml @@ -30,7 +30,7 @@ } @GUI::Label { - text: "File name:" + text: "Filename:" text_alignment: "CenterRight" fixed_height: 24 } diff --git a/Userland/Libraries/LibKeyboard/CharacterMap.h b/Userland/Libraries/LibKeyboard/CharacterMap.h index 48407cf20e..d12c1f4940 100644 --- a/Userland/Libraries/LibKeyboard/CharacterMap.h +++ b/Userland/Libraries/LibKeyboard/CharacterMap.h @@ -20,7 +20,7 @@ class CharacterMap { public: CharacterMap(const String& map_name, const CharacterMapData& map_data); - static Optional<CharacterMap> load_from_file(const String& file_name); + static Optional<CharacterMap> load_from_file(const String& filename); #ifndef KERNEL int set_system_map(); diff --git a/Userland/Libraries/LibKeyboard/CharacterMapFile.cpp b/Userland/Libraries/LibKeyboard/CharacterMapFile.cpp index cdefe24023..05fb406383 100644 --- a/Userland/Libraries/LibKeyboard/CharacterMapFile.cpp +++ b/Userland/Libraries/LibKeyboard/CharacterMapFile.cpp @@ -11,13 +11,13 @@ namespace Keyboard { -Optional<CharacterMapData> CharacterMapFile::load_from_file(const String& file_name) +Optional<CharacterMapData> CharacterMapFile::load_from_file(const String& filename) { - auto path = file_name; + auto path = filename; if (!path.ends_with(".json")) { StringBuilder full_path; full_path.append("/res/keymaps/"); - full_path.append(file_name); + full_path.append(filename); full_path.append(".json"); path = full_path.to_string(); } @@ -25,7 +25,7 @@ Optional<CharacterMapData> CharacterMapFile::load_from_file(const String& file_n auto file = Core::File::construct(path); file->open(Core::IODevice::ReadOnly); if (!file->is_open()) { - dbgln("Failed to open {}: {}", file_name, file->error_string()); + dbgln("Failed to open {}: {}", filename, file->error_string()); return {}; } diff --git a/Userland/Libraries/LibKeyboard/CharacterMapFile.h b/Userland/Libraries/LibKeyboard/CharacterMapFile.h index 361901f13c..c11800d612 100644 --- a/Userland/Libraries/LibKeyboard/CharacterMapFile.h +++ b/Userland/Libraries/LibKeyboard/CharacterMapFile.h @@ -14,7 +14,7 @@ namespace Keyboard { class CharacterMapFile { public: - static Optional<CharacterMapData> load_from_file(const String& file_name); + static Optional<CharacterMapData> load_from_file(const String& filename); private: static Vector<u32> read_map(const JsonObject& json, const String& name); diff --git a/Userland/Libraries/LibPCIDB/Database.cpp b/Userland/Libraries/LibPCIDB/Database.cpp index 3821049d68..4282afd84c 100644 --- a/Userland/Libraries/LibPCIDB/Database.cpp +++ b/Userland/Libraries/LibPCIDB/Database.cpp @@ -12,9 +12,9 @@ namespace PCIDB { -RefPtr<Database> Database::open(const String& file_name) +RefPtr<Database> Database::open(const String& filename) { - auto file_or_error = MappedFile::map(file_name); + auto file_or_error = MappedFile::map(filename); if (file_or_error.is_error()) return nullptr; auto res = adopt_ref(*new Database(file_or_error.release_value())); diff --git a/Userland/Libraries/LibPCIDB/Database.h b/Userland/Libraries/LibPCIDB/Database.h index 704d643f89..01a0073c8d 100644 --- a/Userland/Libraries/LibPCIDB/Database.h +++ b/Userland/Libraries/LibPCIDB/Database.h @@ -53,7 +53,7 @@ struct Class { class Database : public RefCounted<Database> { public: - static RefPtr<Database> open(const String& file_name); + static RefPtr<Database> open(const String& filename); static RefPtr<Database> open() { return open("/res/pci.ids"); }; const StringView get_vendor(u16 vendor_id) const; diff --git a/Userland/Libraries/LibVT/TerminalWidget.cpp b/Userland/Libraries/LibVT/TerminalWidget.cpp index 328fbd602a..db287562eb 100644 --- a/Userland/Libraries/LibVT/TerminalWidget.cpp +++ b/Userland/Libraries/LibVT/TerminalWidget.cpp @@ -93,7 +93,7 @@ TerminalWidget::TerminalWidget(int ptm_fd, bool automatic_size_policy, RefPtr<Co update(); }; - dbgln("Load config file from {}", m_config->file_name()); + dbgln("Load config file from {}", m_config->filename()); m_cursor_blink_timer->set_interval(m_config->read_num_entry("Text", "CursorBlinkInterval", 500)); diff --git a/Userland/Services/LookupServer/LookupServer.cpp b/Userland/Services/LookupServer/LookupServer.cpp index 442f009059..cac9f0f28e 100644 --- a/Userland/Services/LookupServer/LookupServer.cpp +++ b/Userland/Services/LookupServer/LookupServer.cpp @@ -37,7 +37,7 @@ LookupServer::LookupServer() s_the = this; auto config = Core::ConfigFile::get_for_system("LookupServer"); - dbgln("Using network config file at {}", config->file_name()); + dbgln("Using network config file at {}", config->filename()); m_nameservers = config->read_entry("DNS", "Nameservers", "1.1.1.1,1.0.0.1").split(','); load_etc_hosts(); diff --git a/Userland/Services/WindowServer/Cursor.cpp b/Userland/Services/WindowServer/Cursor.cpp index 9722be3390..a62ebe3bfc 100644 --- a/Userland/Services/WindowServer/Cursor.cpp +++ b/Userland/Services/WindowServer/Cursor.cpp @@ -10,7 +10,7 @@ namespace WindowServer { -CursorParams CursorParams::parse_from_file_name(const StringView& cursor_path, const Gfx::IntPoint& default_hotspot) +CursorParams CursorParams::parse_from_filename(const StringView& cursor_path, const Gfx::IntPoint& default_hotspot) { LexicalPath path(cursor_path); if (!path.is_valid()) { @@ -123,7 +123,7 @@ NonnullRefPtr<Cursor> Cursor::create(NonnullRefPtr<Gfx::Bitmap>&& bitmap) NonnullRefPtr<Cursor> Cursor::create(NonnullRefPtr<Gfx::Bitmap>&& bitmap, const StringView& filename) { auto default_hotspot = bitmap->rect().center(); - return adopt_ref(*new Cursor(move(bitmap), CursorParams::parse_from_file_name(filename, default_hotspot))); + return adopt_ref(*new Cursor(move(bitmap), CursorParams::parse_from_filename(filename, default_hotspot))); } RefPtr<Cursor> Cursor::create(Gfx::StandardCursor standard_cursor) diff --git a/Userland/Services/WindowServer/Cursor.h b/Userland/Services/WindowServer/Cursor.h index c615396e25..a6f237f181 100644 --- a/Userland/Services/WindowServer/Cursor.h +++ b/Userland/Services/WindowServer/Cursor.h @@ -13,7 +13,7 @@ namespace WindowServer { class CursorParams { public: - static CursorParams parse_from_file_name(const StringView&, const Gfx::IntPoint&); + static CursorParams parse_from_filename(const StringView&, const Gfx::IntPoint&); CursorParams(const Gfx::IntPoint& hotspot) : m_hotspot(hotspot) { diff --git a/Userland/Services/WindowServer/WindowManager.cpp b/Userland/Services/WindowServer/WindowManager.cpp index 30daf61036..1986507e2b 100644 --- a/Userland/Services/WindowServer/WindowManager.cpp +++ b/Userland/Services/WindowServer/WindowManager.cpp @@ -116,13 +116,13 @@ bool WindowManager::set_resolution(int width, int height, int scale) } if (m_config) { if (success) { - dbgln("Saving resolution: {} @ {}x to config file at {}", Gfx::IntSize(width, height), scale, m_config->file_name()); + dbgln("Saving resolution: {} @ {}x to config file at {}", Gfx::IntSize(width, height), scale, m_config->filename()); m_config->write_num_entry("Screen", "Width", width); m_config->write_num_entry("Screen", "Height", height); m_config->write_num_entry("Screen", "ScaleFactor", scale); m_config->sync(); } else { - dbgln("Saving fallback resolution: {} @1x to config file at {}", resolution(), m_config->file_name()); + dbgln("Saving fallback resolution: {} @1x to config file at {}", resolution(), m_config->filename()); m_config->write_num_entry("Screen", "Width", resolution().width()); m_config->write_num_entry("Screen", "Height", resolution().height()); m_config->write_num_entry("Screen", "ScaleFactor", 1); @@ -140,7 +140,7 @@ Gfx::IntSize WindowManager::resolution() const void WindowManager::set_acceleration_factor(double factor) { Screen::the().set_acceleration_factor(factor); - dbgln("Saving acceleration factor {} to config file at {}", factor, m_config->file_name()); + dbgln("Saving acceleration factor {} to config file at {}", factor, m_config->filename()); m_config->write_entry("Mouse", "AccelerationFactor", String::formatted("{}", factor)); m_config->sync(); } @@ -148,7 +148,7 @@ void WindowManager::set_acceleration_factor(double factor) void WindowManager::set_scroll_step_size(unsigned step_size) { Screen::the().set_scroll_step_size(step_size); - dbgln("Saving scroll step size {} to config file at {}", step_size, m_config->file_name()); + dbgln("Saving scroll step size {} to config file at {}", step_size, m_config->filename()); m_config->write_entry("Mouse", "ScrollStepSize", String::number(step_size)); m_config->sync(); } @@ -157,7 +157,7 @@ void WindowManager::set_double_click_speed(int speed) { VERIFY(speed >= double_click_speed_min && speed <= double_click_speed_max); m_double_click_speed = speed; - dbgln("Saving double-click speed {} to config file at {}", speed, m_config->file_name()); + dbgln("Saving double-click speed {} to config file at {}", speed, m_config->filename()); m_config->write_entry("Input", "DoubleClickSpeed", String::number(speed)); m_config->sync(); } diff --git a/Userland/Utilities/head.cpp b/Userland/Utilities/head.cpp index d51b66f6a2..8455dedc23 100644 --- a/Userland/Utilities/head.cpp +++ b/Userland/Utilities/head.cpp @@ -30,8 +30,8 @@ int main(int argc, char** argv) args_parser.set_general_help("Print the beginning ('head') of a file."); args_parser.add_option(line_count, "Number of lines to print (default 10)", "lines", 'n', "number"); args_parser.add_option(char_count, "Number of characters to print", "characters", 'c', "number"); - args_parser.add_option(never_print_filenames, "Never print file names", "quiet", 'q'); - args_parser.add_option(always_print_filenames, "Always print file names", "verbose", 'v'); + args_parser.add_option(never_print_filenames, "Never print filenames", "quiet", 'q'); + args_parser.add_option(always_print_filenames, "Always print filenames", "verbose", 'v'); args_parser.add_positional_argument(files, "File to process", "file", Core::ArgsParser::Required::No); args_parser.parse(argc, argv); diff --git a/Userland/Utilities/js.cpp b/Userland/Utilities/js.cpp index b2f2ed09fe..3045f2d5d6 100644 --- a/Userland/Utilities/js.cpp +++ b/Userland/Utilities/js.cpp @@ -574,8 +574,8 @@ JS_DEFINE_NATIVE_FUNCTION(ReplObject::repl_help) outln("REPL commands:"); outln(" exit(code): exit the REPL with specified code. Defaults to 0."); outln(" help(): display this menu"); - outln(" load(files): accepts file names as params to load into running session. For example load(\"js/1.js\", \"js/2.js\", \"js/3.js\")"); - outln(" save(file): accepts a file name, writes REPL input history to a file. For example: save(\"foo.txt\")"); + outln(" load(files): accepts filenames as params to load into running session. For example load(\"js/1.js\", \"js/2.js\", \"js/3.js\")"); + outln(" save(file): accepts a filename, writes REPL input history to a file. For example: save(\"foo.txt\")"); return JS::js_undefined(); } @@ -585,10 +585,10 @@ JS_DEFINE_NATIVE_FUNCTION(ReplObject::load_file) return JS::Value(false); for (auto& file : vm.call_frame().arguments) { - String file_name = file.as_string().string(); - auto js_file = Core::File::construct(file_name); + String filename = file.as_string().string(); + auto js_file = Core::File::construct(filename); if (!js_file->open(Core::IODevice::ReadOnly)) { - warnln("Failed to open {}: {}", file_name, js_file->error_string()); + warnln("Failed to open {}: {}", filename, js_file->error_string()); continue; } auto file_contents = js_file->read_all(); diff --git a/Userland/Utilities/lsof.cpp b/Userland/Utilities/lsof.cpp index e67eeb06a1..7cb86a9625 100644 --- a/Userland/Utilities/lsof.cpp +++ b/Userland/Utilities/lsof.cpp @@ -124,7 +124,7 @@ int main(int argc, char* argv[]) int arg_uid_int = -1; int arg_pgid { -1 }; pid_t arg_pid { -1 }; - const char* arg_file_name { nullptr }; + const char* arg_filename { nullptr }; if (argc == 1) arg_all_processes = true; @@ -135,7 +135,7 @@ int main(int argc, char* argv[]) parser.add_option(arg_fd, "Select by file descriptor", nullptr, 'd', "fd"); parser.add_option(arg_uid, "Select by login/UID", nullptr, 'u', "login/UID"); parser.add_option(arg_pgid, "Select by process group ID", nullptr, 'g', "PGID"); - parser.add_positional_argument(arg_file_name, "File name", "file name", Core::ArgsParser::Required::No); + parser.add_positional_argument(arg_filename, "Filename", "filename", Core::ArgsParser::Required::No); parser.parse(argc, argv); } { @@ -164,7 +164,7 @@ int main(int argc, char* argv[]) || (arg_uid_int != -1 && (int)process.value.uid == arg_uid_int) || (arg_uid != nullptr && process.value.username == arg_uid) || (arg_pgid != -1 && (int)process.value.pgid == arg_pgid) - || (arg_file_name != nullptr && file.name == arg_file_name)) + || (arg_filename != nullptr && file.name == arg_filename)) display_entry(file, process.value); } } diff --git a/Userland/Utilities/md.cpp b/Userland/Utilities/md.cpp index 306830756c..564ae282ca 100644 --- a/Userland/Utilities/md.cpp +++ b/Userland/Utilities/md.cpp @@ -22,7 +22,7 @@ int main(int argc, char* argv[]) return 1; } - const char* file_name = nullptr; + const char* filename = nullptr; bool html = false; int view_width = 0; @@ -30,7 +30,7 @@ int main(int argc, char* argv[]) args_parser.set_general_help("Render Markdown to some other format."); args_parser.add_option(html, "Render to HTML rather than for the terminal", "html", 'H'); args_parser.add_option(view_width, "Viewport width for the terminal (defaults to current terminal width)", "view-width", 0, "width"); - args_parser.add_positional_argument(file_name, "Path to Markdown file", "path", Core::ArgsParser::Required::No); + args_parser.add_positional_argument(filename, "Path to Markdown file", "path", Core::ArgsParser::Required::No); args_parser.parse(argc, argv); if (!html && view_width == 0) { @@ -47,10 +47,10 @@ int main(int argc, char* argv[]) } auto file = Core::File::construct(); bool success; - if (file_name == nullptr) { + if (filename == nullptr) { success = file->open(STDIN_FILENO, Core::IODevice::OpenMode::ReadOnly, Core::File::ShouldCloseFileDescriptor::No); } else { - file->set_filename(file_name); + file->set_filename(filename); success = file->open(Core::IODevice::OpenMode::ReadOnly); } if (!success) { diff --git a/Userland/Utilities/pathchk.cpp b/Userland/Utilities/pathchk.cpp index d4ff7fc9aa..77caa97570 100644 --- a/Userland/Utilities/pathchk.cpp +++ b/Userland/Utilities/pathchk.cpp @@ -42,17 +42,17 @@ int main(int argc, char** argv) unsigned long name_max = flag_most_posix ? _POSIX_NAME_MAX : pathconf(str_path.characters(), _PC_NAME_MAX); if (str_path.length() > path_max) { - warnln("{}: limit {} exceeded by length {} of file name '{}'", argv[0], path_max, str_path.length(), str_path); + warnln("{}: limit {} exceeded by length {} of filename '{}'", argv[0], path_max, str_path.length(), str_path); fail = true; continue; } if (flag_most_posix) { - // POSIX portable file name character set (a-z A-Z 0-9 . _ -) + // POSIX portable filename character set (a-z A-Z 0-9 . _ -) for (long unsigned i = 0; i < str_path.length(); ++i) { auto c = path[i]; if (!(c >= 'a' && c <= 'z') && !(c >= 'A' && c <= 'Z') && !(c >= '0' && c <= '9') && c != '/' && c != '.' && c != '-' && c != '_') { - warnln("{}: non-portable character '{}' in file name '{}'", argv[0], path[i], str_path); + warnln("{}: non-portable character '{}' in filename '{}'", argv[0], path[i], str_path); fail = true; continue; } @@ -70,7 +70,7 @@ int main(int argc, char** argv) if (flag_empty_name_and_leading_dash) { if (str_path.is_empty()) { - warnln("{}: empty file name", argv[0]); + warnln("{}: empty filename", argv[0]); fail = true; continue; } @@ -79,13 +79,13 @@ int main(int argc, char** argv) for (auto& component : str_path.split('/')) { if (flag_empty_name_and_leading_dash) { if (component.starts_with('-')) { - warnln("{}: leading '-' in a component of file name '{}'", argv[0], str_path); + warnln("{}: leading '-' in a component of filename '{}'", argv[0], str_path); fail = true; break; } } if (component.length() > name_max) { - warnln("{}: limit {} exceeded by length {} of file name component '{}'", argv[0], name_max, component.length(), component.characters()); + warnln("{}: limit {} exceeded by length {} of filename component '{}'", argv[0], name_max, component.length(), component.characters()); fail = true; break; } diff --git a/Userland/Utilities/tar.cpp b/Userland/Utilities/tar.cpp index 7877787b37..18ed93681c 100644 --- a/Userland/Utilities/tar.cpp +++ b/Userland/Utilities/tar.cpp @@ -68,7 +68,7 @@ int main(int argc, char** argv) } for (; !tar_stream.finished(); tar_stream.advance()) { if (list || verbose) - outln("{}", tar_stream.header().file_name()); + outln("{}", tar_stream.header().filename()); if (extract) { Archive::TarFileStream file_stream = tar_stream.file_contents(); @@ -77,7 +77,7 @@ int main(int argc, char** argv) switch (header.type_flag()) { case Archive::TarFileType::NormalFile: case Archive::TarFileType::AlternateNormalFile: { - int fd = open(String(header.file_name()).characters(), O_CREAT | O_WRONLY, header.mode()); + int fd = open(String(header.filename()).characters(), O_CREAT | O_WRONLY, header.mode()); if (fd < 0) { perror("open"); return 1; @@ -95,7 +95,7 @@ int main(int argc, char** argv) break; } case Archive::TarFileType::Directory: { - if (mkdir(String(header.file_name()).characters(), header.mode())) { + if (mkdir(String(header.filename()).characters(), header.mode())) { perror("mkdir"); return 1; } diff --git a/Userland/Utilities/test-crypto.cpp b/Userland/Utilities/test-crypto.cpp index bc676de168..191d85ddb1 100644 --- a/Userland/Utilities/test-crypto.cpp +++ b/Userland/Utilities/test-crypto.cpp @@ -128,7 +128,7 @@ static int run(Function<void(const char*, size_t)> fn) } } else { if (filename == nullptr) { - puts("must specify a file name"); + puts("must specify a filename"); return 1; } if (!Core::File::exists(filename)) { |