Skip to content

Commit

Permalink
Everywhere: "file name" => "filename"
Browse files Browse the repository at this point in the history
  • Loading branch information
awesomekling committed Apr 29, 2021
1 parent def1f14 commit 7ae7170
Show file tree
Hide file tree
Showing 59 changed files with 181 additions and 181 deletions.
4 changes: 2 additions & 2 deletions AK/SourceLocation.h
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -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());
}
};

Expand Down
2 changes: 1 addition & 1 deletion AK/Tests/TestSourceLocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down
4 changes: 2 additions & 2 deletions Kernel/FileSystem/ext2_fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
};

/*
Expand All @@ -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 */
};

/*
Expand Down
2 changes: 1 addition & 1 deletion Kernel/Thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
8 changes: 4 additions & 4 deletions Meta/lint-keymaps.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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 = []
Expand Down
2 changes: 1 addition & 1 deletion Meta/lint-ports.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Userland/Applications/Debugger/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class FileOperationProgressWidget : public GUI::Widget {

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

Expand Down
20 changes: 10 additions & 10 deletions Userland/Applications/KeyboardMapper/KeyboardMapperWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand All @@ -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");

Expand All @@ -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;

Expand All @@ -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());

Expand All @@ -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();
}

Expand Down Expand Up @@ -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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class KeyboardMapperWidget : public GUI::Widget {
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 };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -34,7 +34,7 @@ class CharacterMapFileListModel final : public GUI::Model {
VERIFY(index.column() == 0);

if (role == GUI::ModelRole::Display)
return m_file_names.at(index.row());
return m_filenames.at(index.row());

return {};
}
Expand All @@ -45,10 +45,10 @@ class CharacterMapFileListModel final : public GUI::Model {
}

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;
};
4 changes: 2 additions & 2 deletions Userland/Applications/Terminal/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
}
Expand Down
8 changes: 4 additions & 4 deletions Userland/DevTools/HackStudio/HackStudioWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion Userland/DevTools/HackStudio/HackStudioWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class HackStudioWidget : public GUI::Widget {
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();
Expand Down
30 changes: 15 additions & 15 deletions Userland/DevTools/HackStudio/LanguageServers/ClientConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class ParserAutoComplete : public AutoCompleteEngine {
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 {
Expand Down
Loading

0 comments on commit 7ae7170

Please sign in to comment.