Serenity Operating System
at master 47 lines 1.3 kB view raw
1/* 2 * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org> 3 * 4 * SPDX-License-Identifier: BSD-2-Clause 5 */ 6 7#pragma once 8 9#include "ProjectConfig.h" 10#include "ProjectFile.h" 11#include <AK/LexicalPath.h> 12#include <AK/Noncopyable.h> 13#include <AK/OwnPtr.h> 14#include <LibGUI/FileSystemModel.h> 15 16namespace HackStudio { 17 18class Project { 19 AK_MAKE_NONCOPYABLE(Project); 20 AK_MAKE_NONMOVABLE(Project); 21 22public: 23 static OwnPtr<Project> open_with_root_path(DeprecatedString const& root_path); 24 25 GUI::FileSystemModel& model() { return *m_model; } 26 const GUI::FileSystemModel& model() const { return *m_model; } 27 DeprecatedString name() const { return LexicalPath::basename(m_root_path); } 28 DeprecatedString root_path() const { return m_root_path; } 29 30 NonnullRefPtr<ProjectFile> create_file(DeprecatedString const& path) const; 31 32 void for_each_text_file(Function<void(ProjectFile const&)>) const; 33 DeprecatedString to_absolute_path(DeprecatedString const&) const; 34 bool project_is_serenity() const; 35 36 static constexpr auto config_file_path = ".hackstudio/config.json"sv; 37 NonnullOwnPtr<ProjectConfig> config() const; 38 39private: 40 explicit Project(DeprecatedString const& root_path); 41 42 RefPtr<GUI::FileSystemModel> m_model; 43 44 DeprecatedString m_root_path; 45}; 46 47}