mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 03:47:34 +00: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
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
Add a link
Reference in a new issue