Files
mimiclaw/main/tools/tool_files.h
Bin Meng 22886cf0f2 chore: avoid hardcoding file paths via MIMI_SPIFFS_BASE
Use MIMI_SPIFFS_BASE to centralize file path definitions, making the
base path configurable instead of hardcoded.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
2026-02-26 11:37:34 +08:00

29 lines
911 B
C

#pragma once
#include "esp_err.h"
#include <stddef.h>
/**
* Read a file from SPIFFS.
* Input JSON: {"path": "<MIMI_SPIFFS_BASE>/..."}
*/
esp_err_t tool_read_file_execute(const char *input_json, char *output, size_t output_size);
/**
* Write/overwrite a file on SPIFFS.
* Input JSON: {"path": "<MIMI_SPIFFS_BASE>/...", "content": "..."}
*/
esp_err_t tool_write_file_execute(const char *input_json, char *output, size_t output_size);
/**
* Find-and-replace edit a file on SPIFFS.
* Input JSON: {"path": "<MIMI_SPIFFS_BASE>/...", "old_string": "...", "new_string": "..."}
*/
esp_err_t tool_edit_file_execute(const char *input_json, char *output, size_t output_size);
/**
* List files on SPIFFS, optionally filtered by path prefix.
* Input JSON: {"prefix": "<MIMI_SPIFFS_BASE>/..."} (prefix is optional)
*/
esp_err_t tool_list_dir_execute(const char *input_json, char *output, size_t output_size);