mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-23 17:52:26 -05:00
HackStudio: Rename Project::get_file() to Project::create_file()
The function no longer looks for the already opened files, so let's emphasize that by renaming it to `create_file`. :^)
This commit is contained in:
parent
4a1974b174
commit
d811ad921c
Notes:
sideshowbarker
2024-07-19 17:13:11 +09:00
Author: https://github.com/krkk Commit: https://github.com/SerenityOS/serenity/commit/d811ad921ca Pull-request: https://github.com/SerenityOS/serenity/pull/9860 Reviewed-by: https://github.com/itamar8910 ✅
3 changed files with 5 additions and 5 deletions
|
@ -262,7 +262,7 @@ bool HackStudioWidget::open_file(const String& full_filename, size_t line, size_
|
|||
if (auto it = m_open_files.find(filename); it != m_open_files.end()) {
|
||||
new_project_file = it->value;
|
||||
} else {
|
||||
new_project_file = m_project->get_file(filename);
|
||||
new_project_file = m_project->create_file(filename);
|
||||
m_open_files.set(filename, *new_project_file);
|
||||
m_open_files_vector.append(filename);
|
||||
|
||||
|
@ -699,7 +699,7 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_save_as_action()
|
|||
}
|
||||
current_editor_wrapper().save();
|
||||
|
||||
auto new_project_file = m_project->get_file(relative_file_path);
|
||||
auto new_project_file = m_project->create_file(relative_file_path);
|
||||
m_open_files.set(relative_file_path, *new_project_file);
|
||||
m_open_files_vector.append(relative_file_path);
|
||||
|
||||
|
|
|
@ -40,12 +40,12 @@ static void traverse_model(const GUI::FileSystemModel& model, const GUI::ModelIn
|
|||
void Project::for_each_text_file(Function<void(const ProjectFile&)> callback) const
|
||||
{
|
||||
traverse_model(model(), {}, [&](auto& index) {
|
||||
auto file = get_file(model().full_path(index));
|
||||
auto file = create_file(model().full_path(index));
|
||||
callback(*file);
|
||||
});
|
||||
}
|
||||
|
||||
NonnullRefPtr<ProjectFile> Project::get_file(const String& path) const
|
||||
NonnullRefPtr<ProjectFile> Project::create_file(const String& path) const
|
||||
{
|
||||
auto full_path = to_absolute_path(path);
|
||||
return ProjectFile::construct_with_name(full_path);
|
||||
|
|
|
@ -26,7 +26,7 @@ public:
|
|||
String name() const { return LexicalPath::basename(m_root_path); }
|
||||
String root_path() const { return m_root_path; }
|
||||
|
||||
NonnullRefPtr<ProjectFile> get_file(const String& path) const;
|
||||
NonnullRefPtr<ProjectFile> create_file(const String& path) const;
|
||||
|
||||
void for_each_text_file(Function<void(const ProjectFile&)>) const;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue