Base class for filesystem operations. More...
#include <filesystem_tool.h>
Inherits yaze::cli::resources::CommandHandler.
Inherited by yaze::cli::agent::tools::FileSystemExistsTool, yaze::cli::agent::tools::FileSystemInfoTool, yaze::cli::agent::tools::FileSystemListTool, and yaze::cli::agent::tools::FileSystemReadTool.

Protected Member Functions | |
| absl::StatusOr< std::filesystem::path > | ValidatePath (const std::string &path_str) const |
| Validate and normalize a path for safe access. | |
| std::filesystem::path | GetProjectRoot () const |
| Get the project root directory. | |
| bool | IsPathInProject (const std::filesystem::path &path) const |
| Check if a path is within the project directory. | |
| std::string | FormatFileSize (uintmax_t size_bytes) const |
| Format file size for human-readable output. | |
| std::string | FormatTimestamp (const std::filesystem::file_time_type &time) const |
| Format timestamp for readable output. | |
Protected Member Functions inherited from yaze::cli::resources::CommandHandler | |
| virtual absl::Status | ValidateArgs (const ArgumentParser &parser)=0 |
| Validate command arguments. | |
| virtual absl::Status | Execute (Rom *rom, const ArgumentParser &parser, OutputFormatter &formatter)=0 |
| Execute the command business logic. | |
| virtual std::string | GetDefaultFormat () const |
| Get the default output format ("json" or "text") | |
| virtual std::string | GetOutputTitle () const |
| Get the output title for formatting. | |
Additional Inherited Members | |
Public Member Functions inherited from yaze::cli::resources::CommandHandler | |
| virtual | ~CommandHandler ()=default |
| absl::Status | Run (const std::vector< std::string > &args, Rom *rom_context, std::string *captured_output=nullptr) |
| Execute the command. | |
| virtual std::string | GetName () const =0 |
| Get the command name. | |
| virtual Descriptor | Describe () const |
| Provide metadata for TUI/help summaries. | |
| virtual std::string | GetUsage () const =0 |
| Get the command usage string. | |
| virtual bool | RequiresRom () const |
| Check if the command requires a loaded ROM. | |
| virtual bool | RequiresLabels () const |
| Check if the command requires ROM labels. | |
| virtual void | SetProjectContext (project::YazeProject *project) |
| Set the YazeProject context. Default implementation does nothing, override if tool needs project info. | |
| virtual void | SetAsarWrapper (core::AsarWrapper *asar_wrapper) |
| Set the AsarWrapper context. Default implementation does nothing, override if tool needs Asar access. | |
| virtual void | SetRomContext (Rom *rom) |
| Set the ROM context for tools that need ROM access. Default implementation stores the ROM pointer for subclass use. | |
Protected Attributes inherited from yaze::cli::resources::CommandHandler | |
| Rom * | rom_ = nullptr |
| project::YazeProject * | project_ = nullptr |
| core::AsarWrapper * | asar_wrapper_ = nullptr |
Base class for filesystem operations.
Provides common functionality for filesystem tools including:
Definition at line 24 of file filesystem_tool.h.
|
protected |
Validate and normalize a path for safe access.
Ensures the path:
Definition at line 23 of file filesystem_tool.cc.
References GetProjectRoot(), and IsPathInProject().
Referenced by yaze::cli::agent::tools::FileSystemListTool::Execute(), yaze::cli::agent::tools::FileSystemReadTool::Execute(), yaze::cli::agent::tools::FileSystemExistsTool::Execute(), and yaze::cli::agent::tools::FileSystemInfoTool::Execute().

|
protected |
Get the project root directory.
Returns the root directory of the yaze project. Defaults to current working directory if not explicitly set.
Definition at line 71 of file filesystem_tool.cc.
Referenced by IsPathInProject(), and ValidatePath().
|
protected |
Check if a path is within the project directory.
Definition at line 98 of file filesystem_tool.cc.
References GetProjectRoot().
Referenced by ValidatePath().

|
protected |
Format file size for human-readable output.
Definition at line 110 of file filesystem_tool.cc.
Referenced by yaze::cli::agent::tools::FileSystemListTool::Execute(), yaze::cli::agent::tools::FileSystemReadTool::Execute(), and yaze::cli::agent::tools::FileSystemInfoTool::Execute().
|
protected |
Format timestamp for readable output.
Definition at line 127 of file filesystem_tool.cc.
Referenced by yaze::cli::agent::tools::FileSystemInfoTool::Execute().