From 81080a3a8b9cb7caa05bee941f4015dcfcca5ced Mon Sep 17 00:00:00 2001 From: SG Date: Sun, 25 Jul 2021 21:55:23 +1000 Subject: [PATCH] [FL-1191] Storage: CLI mkdir command #603 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: あく --- applications/storage/storage-cli.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/applications/storage/storage-cli.c b/applications/storage/storage-cli.c index 203daa8a..684e9a8b 100644 --- a/applications/storage/storage-cli.c +++ b/applications/storage/storage-cli.c @@ -30,6 +30,7 @@ void storage_cli_print_usage() { "\twrite\t - read data from cli and append it to file, should contain how many bytes you want to write\r\n"); printf("\tcopy\t - copy file to new file, must contain new path\r\n"); printf("\trename\t - move file to new file, must contain new path\r\n"); + printf("\tmkdir\t - creates a new directory\r\n"); }; void storage_cli_print_error(FS_Error error) { @@ -285,6 +286,17 @@ void storage_cli_rename(Cli* cli, string_t old_path, string_t args) { furi_record_close("storage"); } +void storage_cli_mkdir(Cli* cli, string_t path) { + Storage* api = furi_record_open("storage"); + FS_Error error = storage_common_mkdir(api, string_get_cstr(path)); + + if(error != FSE_OK) { + storage_cli_print_error(error); + } + + furi_record_close("storage"); +} + void storage_cli(Cli* cli, string_t args, void* context) { string_t cmd; string_t path; @@ -342,6 +354,11 @@ void storage_cli(Cli* cli, string_t args, void* context) { break; } + if(string_cmp_str(cmd, "mkdir") == 0) { + storage_cli_mkdir(cli, path); + break; + } + storage_cli_print_usage(); } while(false);