1#ifndef YAZE_APP_EDITOR_SYSTEM_FILE_BROWSER_H_
2#define YAZE_APP_EDITOR_SYSTEM_FILE_BROWSER_H_
55 bool IsIgnored(
const std::string& path,
bool is_directory)
const;
68 bool MatchGlob(
const std::string& text,
const std::string& pattern)
const;
137 void SetFileFilter(
const std::vector<std::string>& extensions);
159 bool ShouldShow(
const std::filesystem::path& path,
bool is_directory)
const;
File system browser for the sidebar.
void DrawCompact()
Draw a compact version for narrow sidebars.
std::set< std::string > file_filter_
bool GetShowHiddenFiles() const
std::function< void(const std::string &path)> FileClickedCallback
const char * GetFileIcon(FileEntry::FileType type) const
void SetShowHiddenFiles(bool show)
size_t GetDirectoryCount() const
void SetFileClickedCallback(FileClickedCallback callback)
std::function< void(const std::string &path)> DirectoryClickedCallback
void Refresh()
Refresh the file tree from disk.
bool GetRespectGitignore() const
bool ShouldShow(const std::filesystem::path &path, bool is_directory) const
bool HasRootPath() const
Check if a root path is set.
void SetFileFilter(const std::vector< std::string > &extensions)
Add file extensions to filter (empty = show all)
void SetRootPath(const std::string &path)
Set the root path for the file browser.
static constexpr size_t kMaxEntries
const std::string & GetRootPath() const
Get the current root path.
void Draw()
Draw the file tree in ImGui.
DirectoryClickedCallback on_directory_clicked_
FileEntry::FileType DetectFileType(const std::string &filename) const
void ScanDirectory(const std::filesystem::path &path, FileEntry &parent, int depth=0)
static constexpr int kMaxDepth
void SetRespectGitignore(bool respect)
FileClickedCallback on_file_clicked_
void DrawEntry(FileEntry &entry, int depth=0)
void SetDirectoryClickedCallback(DirectoryClickedCallback callback)
GitignoreParser gitignore_parser_
size_t GetFileCount() const
bool MatchesFilter(const std::string &filename) const
std::string selected_path_
Simple .gitignore pattern matcher.
std::vector< Pattern > patterns_
bool MatchPattern(const std::string &path, const Pattern &pattern) const
void AddPattern(const std::string &pattern)
bool IsIgnored(const std::string &path, bool is_directory) const
bool MatchGlob(const std::string &text, const std::string &pattern) const
void LoadFromFile(const std::string &gitignore_path)
Represents a file or folder in the file browser.
std::vector< FileEntry > children