Everywhere: "file name" => "filename"
This commit is contained in:
parent
def1f1444a
commit
7ae7170d61
Notes:
sideshowbarker
2024-07-18 18:53:39 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/7ae7170d614
59 changed files with 181 additions and 181 deletions
AK
Kernel
Meta
Userland
Applications
Debugger
FileManager
KeyboardMapper
KeyboardSettings
Terminal
DevTools/HackStudio
HackStudioWidget.cppHackStudioWidget.h
LanguageServers
main.cppGames
Libraries
LibArchive
LibCore
LibDebug
LibDesktop
LibDl
LibELF
LibGUI
LibKeyboard
LibPCIDB
LibVT
Services
Utilities
|
@ -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());
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
|
|
@ -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 */
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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 = []
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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 };
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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 {};
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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&);
|
||||
|
|
|
@ -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) =|
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 });
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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 };
|
||||
};
|
||||
|
|
|
@ -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 {};
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 */
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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 = [&] {
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
}
|
||||
|
||||
@GUI::Label {
|
||||
text: "File name:"
|
||||
text: "Filename:"
|
||||
text_alignment: "CenterRight"
|
||||
fixed_height: 24
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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 {};
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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()));
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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)) {
|
||||
|
|
Loading…
Add table
Reference in a new issue